Export Map Widget

1611
37
10-19-2010 06:47 AM
deleted-user-RjoC4IOGTpoH
New Contributor
Another great widget from Robert which is much appreciated.

I would like to fire off the widget from the toolbar instead of the current lower left position.
I edited the config.xml to place the widget in the toolbar but as expected, when you click on it the widget appears in the lower left and you have to click on it again to run it.

What code changes would be needed to just fire it from the toolbar?

Thanks again Robert.

Nestor.
Tags (2)
0 Kudos
37 Replies
RobertScheitlin__GISP
MVP Emeritus
Noah,

   Edit which config.xml? You have already edited the main config.xml. If you are talking about the exportMap.xml then you just browse to the folder on your file system that the exportMap.xml file is in and open it in NotePad.exe or some other text editor.
0 Kudos
NoahHuntington
Occasional Contributor
Ok So I think I am on the right path.  I have...

1) added ExportMap folder from compiled3.0 folder to widgets folder within application folder. 
2) edited the main config.xml file within the application folder.
3)Still no widget in the widgets catalog of Application builder.

Am I on the right track?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Noah,

   Layout widgets like this one are yet to be supported in Application Builder, hence the manual steps for adding it to the viewer. You are not going to see the widget listed in App Builder. Just run your viewer and you should see the widget.
0 Kudos
NoahHuntington
Occasional Contributor
I think that got it! Thanks for your patience.  Great work you are doing!!!
0 Kudos
MattShetzer
New Contributor
Hi Robert,

Is there anyway to add a watermark image to the export map widget.  For example some text in a png format?

Thank you,
Matt Shetzer
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matt,

   If you are just talking text then here is a easy little mod for the ExportMap Widget:
            protected function export():void
            {
                var map:Map = ViewerContainer.getInstance().mapManager.map;
                map.infoWindow.hide();
                map.infoWindowContent = null;
                loader.visible = true;
                img.filters =[cOver];
                const encoder: JPEGEncoder = new JPEGEncoder(quality);
                map.logoVisible=logovis;
                map.scaleBarVisible=sbvis;
                map.zoomSliderVisible = zoomslidevis;
                map.opaqueBackground = mapbg;
                var mText:Label = new Label();
                mText.text = "Hello World!";
                mText.right = 5;
                mText.bottom = 5;
                mText.setStyle("color", "0x000000");
                map.staticLayer.addElement(mText);
                map.validateNow();
                const imageSnapshot:ImageSnapshot = ImageSnapshot.captureImage(map,0,encoder);
                
                map.scaleBarVisible=true;
                map.opaqueBackground = null;
                map.staticLayer.removeElement(mText);
                map.validateNow();
                const fileReference:FileReference = new FileReference();
                fileReference.save(imageSnapshot.data,fName);
                fileReference.addEventListener(Event.COMPLETE, resetIcon);
                fileReference.addEventListener(Event.CANCEL, resetIcon);
            }
0 Kudos
MattShetzer
New Contributor
Great.  Thanks for the quick answer Robert !!!

Matt

Matt,

   If you are just talking text then here is a easy little mod for the ExportMap Widget:
            protected function export():void
            {
                var map:Map = ViewerContainer.getInstance().mapManager.map;
                map.infoWindow.hide();
                map.infoWindowContent = null;
                loader.visible = true;
                img.filters =[cOver];
                const encoder: JPEGEncoder = new JPEGEncoder(quality);
                map.logoVisible=logovis;
                map.scaleBarVisible=sbvis;
                map.zoomSliderVisible = zoomslidevis;
                map.opaqueBackground = mapbg;
                var mText:Label = new Label();
                mText.text = "Hello World!";
                mText.right = 5;
                mText.bottom = 5;
                mText.setStyle("color", "0x000000");
                map.staticLayer.addElement(mText);
                map.validateNow();
                const imageSnapshot:ImageSnapshot = ImageSnapshot.captureImage(map,0,encoder);
                
                map.scaleBarVisible=true;
                map.opaqueBackground = null;
                map.staticLayer.removeElement(mText);
                map.validateNow();
                const fileReference:FileReference = new FileReference();
                fileReference.save(imageSnapshot.data,fName);
                fileReference.addEventListener(Event.COMPLETE, resetIcon);
                fileReference.addEventListener(Event.CANCEL, resetIcon);
            }
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matt,

   Your welcome. Don't forget to always promote posts that you find helpful.

0 Kudos