POST
|
Yes that would be nice, and it's doable. You can get the PopUpRendererSkin.mxml from downloading the API and make some addition there to accomplish this. My solution is probably not the best one, but it works for me. Basically I'm adding the feature to a new graphiclayer and put a glow filter on it. Here's my customPopUpRendererSkin, my additions are commented so you can see what I've done and change to your own customizations. For example make it flash insted of beeing highlighted or whatever you want. Copy the skin to for example src/com/esri/viewer/skins and then point it out in the defaults.css, something like this: esri|PopUpRenderer { skin-class: ClassReference("com.esri.viewer.skins.customPopUpRendererSkin"); } I'm still in version 2.4, and my customPopUpRendererSkin is based on the one from API 2.4. If you have 2.5, download that new skin and make the changes to that one...
... View more
03-01-2012
03:41 AM
|
0
|
0
|
782
|
POST
|
Barb, and others who would like use groups/headings, I want this functionality as well, and there is a way to do this without adding the functionality to the actual TOC-component. What I've done is that I've rewritten the widget to use several TOC-components, one for each group, and each TOC-components only include the layers belonging to that code. In the config-file I specify my different groups and which layers that belongs to them and then in the code I create an Accordion in my case with the different TOC-components. See the attached image to get an idea of what it might look like, (I've also moved everything to the MapSwitcher and the operational layers box). One big disadvantage is that I have to specify my layers twice, once in the main config file and once in the TOC-widget/MapSwither config file with the exact same name where I also specify the groups. Unfortunately I won't be able to share my code as it is because I've made a lot of my own customizations and haven't been careful enough to comment all of my changes. But the principle of using one TOC-compontent including only some specified layers for each group is a way to achieve groups/headings without to much coding.
... View more
01-19-2012
01:19 AM
|
0
|
0
|
689
|
POST
|
Robert, did you ever got that proxy support code that Jeremy Moore mentioned in an earlier post? What I can tell it isn't implemented yet, right? Jeremy could you share some code? I would like just that part of the code because I'm using my own customized version of this TOCwidget. EDIT: I think I found a solution my self, I've only tested this a little bit in my own application that only has DynamicLayers in the legend, but it seems to work... I made just a few changes to the getLegendData function in TocMapLayerItem.as private function getLegendData(m_layer:*):void
{
if (_legendDataLoaded)
return;
_legendDataLoaded = true;
if (m_layer.hasOwnProperty("url")){
const url:String = m_layer["url"];
if (url === null)
return;
}else{
return;
}
var httpServ:HTTPService = new HTTPService();
httpServ.requestTimeout = lTimeout;
var lname:String;
var lInfos:Array;
if (m_layer is ArcGISTiledMapServiceLayer){
if(m_layer.version >= 10.01){
if(ArcGISTiledMapServiceLayer(m_layer).proxyURL){
//If layer uses proxy (my addition for proxy support)
httpServ.url = ArcGISTiledMapServiceLayer(m_layer).proxyURL + "?" + ArcGISTiledMapServiceLayer(m_layer).url + "/legend?f=json";
}else{
//if layer doesn't use proxy (original code)
httpServ.url = ArcGISTiledMapServiceLayer(m_layer).url + "/legend?f=json";
}
httpServ.resultFormat = "text";
lname = ArcGISTiledMapServiceLayer(m_layer).id;
lInfos = ArcGISTiledMapServiceLayer(m_layer).layerInfos;
httpServ.addEventListener(ResultEvent.RESULT,function(event:ResultEvent):void{processLegend(event,lname,Number.NaN,lInfos,httpServ.url)});
httpServ.send();
}else{
lname = ArcGISTiledMapServiceLayer(m_layer).id;
ArcGISTiledMapServiceLayer(m_layer).addEventListener(DetailsEvent.GET_ALL_DETAILS_COMPLETE,function(event:DetailsEvent):void{getAllDetailsResult(event,lname)});
ArcGISTiledMapServiceLayer(m_layer).addEventListener(FaultEvent.FAULT, function(event:Event):void{FlexGlobals.topLevelApplication.dispatchEvent(new Event("legendDataLoaded$"))});
ArcGISTiledMapServiceLayer(m_layer).getAllDetails();
}
}else if (m_layer is ArcGISDynamicMapServiceLayer){
if(m_layer.version >= 10.01){
if(ArcGISDynamicMapServiceLayer(m_layer).proxyURL){
//If layer uses proxy (my addition for proxy support)
httpServ.url = ArcGISDynamicMapServiceLayer(m_layer).proxyURL + "?" + ArcGISDynamicMapServiceLayer(m_layer).url + "/legend?f=json";
}else{
//if layer doesn't use proxy (original code)
httpServ.url = ArcGISDynamicMapServiceLayer(m_layer).url + "/legend?f=json";
}
httpServ.resultFormat = "text";
lname = ArcGISDynamicMapServiceLayer(m_layer).id;
lInfos = ArcGISDynamicMapServiceLayer(m_layer).layerInfos
httpServ.addEventListener(ResultEvent.RESULT,function(event:ResultEvent):void{processLegend(event,lname,Number.NaN,lInfos,httpServ.url)});
httpServ.send();
}else{
lname = ArcGISDynamicMapServiceLayer(m_layer).id;
ArcGISDynamicMapServiceLayer(m_layer).addEventListener(DetailsEvent.GET_ALL_DETAILS_COMPLETE,function(event:DetailsEvent):void{getAllDetailsResult(event,lname)});
ArcGISDynamicMapServiceLayer(m_layer).addEventListener(FaultEvent.FAULT, function(event:Event):void{FlexGlobals.topLevelApplication.dispatchEvent(new Event("legendDataLoaded$"))});
ArcGISDynamicMapServiceLayer(m_layer).getAllDetails();
}
}else if (m_layer is KMLLayer) {
timeOutVar = setTimeout(getKMLLegend, 100, m_layer);
}else if (m_layer is FeatureLayer){
var FeatServId:Number = Number.NaN;
var msName:String = FeatureLayer(m_layer).url.replace("FeatureServer","MapServer");
if(msName.substring(msName.length - 9) != "MapServer"){
if(FeatureLayer(m_layer).proxyURL){
//If layer uses proxy (my addition for proxy support)
httpServ.url = FeatureLayer(m_layer).proxyURL + "?" + msName.substring(0,msName.lastIndexOf("/")) + "/legend?f=json";
}else{
//if layer doesn't use proxy (original code)
httpServ.url = msName.substring(0,msName.lastIndexOf("/")) + "/legend?f=json";
}
FeatServId = parseInt(msName.substring(msName.lastIndexOf("/")+ 1));
}else{
if(FeatureLayer(m_layer).proxyURL){
//If layer uses proxy (my addition for proxy support)
httpServ.url = FeatureLayer(m_layer).proxyURL + "?" + msName + "/legend?f=json";
}else{
//if layer doesn't use proxy (original code)
httpServ.url = msName + "/legend?f=json";
}
}
if(m_layer.layerDetails.version >= 10.01){
httpServ.resultFormat = "text";
lname = FeatureLayer(m_layer).id;
httpServ.addEventListener(ResultEvent.RESULT,function(event:ResultEvent):void{processLegend(event,lname,FeatServId)});
httpServ.send();
} else {
lname = FeatureLayer(m_layer).id;
getFeatureResult(FeatureLayer(m_layer).layerDetails,lname);
}
}else{
FlexGlobals.topLevelApplication.dispatchEvent(new Event("legendDataLoaded$"));
}
}
... View more
01-04-2012
12:45 AM
|
0
|
0
|
651
|
POST
|
Robert, I understand, thanks anyway for this great widget. I found a way to add show meta data button for WMS layers that shows a modified details window with the legend image, I'll settle for that for now.
... View more
12-29-2011
09:55 PM
|
0
|
0
|
651
|
POST
|
Robert, I know you've been asked about legends for WMS layers before, and that's not your priority now. I'm thought I could take a look at this my self, as a first step I would be happy just to be able to add a single image with a hard coded imageURL for each WMS layer. Can you give me some hints how to accomplish this? My guess so far is that I might start with something like: }else if (m_layer is WMSLayer){ in the getLegendData function in TocMapLayerItem.as but then I'm lost 😃
... View more
12-29-2011
03:14 AM
|
0
|
0
|
651
|
POST
|
http://forums.arcgis.com/threads/45233-WMST-Support-Flex-Viewer There's support for WMST in the API 2.5, but the Viewer doesn't support it.
... View more
12-28-2011
11:33 PM
|
0
|
0
|
227
|
POST
|
I have been able to write some code that provides an url that will work if I copy and paste it into a new browser. I've tried using this url with a httpRequest without any succes so far. A sample would be great!
... View more
12-11-2011
09:37 PM
|
0
|
0
|
391
|
POST
|
This was posted pretty long ago, is there anyone who has been able to do an identify on a WMS layer from flex since then? I've search the forums och documentation for ArcGIS API for flex as well as ArcGIS Viewer for Flex but haven't found anything. If WMS layers is supposed to be supported, I don't think it's too much to ask to be able to perform an identify on them...
... View more
12-06-2011
10:02 PM
|
0
|
0
|
391
|
POST
|
I've been thinking and trying out some solutions for this, and ended up customizing the PopUpRendererSkin. It works but I'm not really satisfied with the solution, what I would like is to use some kind of AppEvent for showing PopUp and closing/hidning PopUp. I've been looking through the documentation but I can't find anything like that, I've tried using SHOW_INFOWINDOW and some other events without success. I've not tried to create my own custom AppEvent, because I wouldn't know how to dispatch the events when PopUp shows or hides, if I knew that I would probably not even have to create any AppEvents. Anyone knows a way to listen to the events of showing and closing/hiding a PopUp? If anyone is interested in the solution I have so far, I got the PopUpRendererSkin.mxml from downloading the API and copied it to src/com/esri/viewer/skins/ and to the default.css I added: esri|PopUpRenderer
{
skin-class: ClassReference("com.esri.viewer.skins.PopUpRendererSkin");
} All the code I put in PopUpRendererSkin.mxml, at the end of the commitProperties function add: // My addition for highlighting popup features...
var glExists:Boolean = false;
var glID:int;
//Go through layerIds in map to check if the highlightGraphics graphiclayer exists and if so get its id.
for (var i:int = 0; i < map.layerIds.length; i++)
{
if (map.layerIds== "highlightGraphics")
{
glID = i;
glExists = true;
}
}
//If highlightGraphics graphicslayer doesn't exist, create it and add it to the map.
if(!glExists){
var gl:GraphicsLayer = new GraphicsLayer();
gl.id = "highlightGraphics";
gl.visible = true;
map.addLayer(gl,200);
//Get the id of the graphicslayer
for (var j:int = 0; j < map.layerIds.length; j++)
{
if (map.layerIds == "highlightGraphics")
{
glID = j;
glExists = true;
}
}
}
//Set the highlight graphic symbol
var hlGraphic:Graphic = new Graphic(graphic.geometry);
switch(hlGraphic.geometry.type)
{
case Geometry.MAPPOINT:
{
hlGraphic.symbol = new SimpleMarkerSymbol("circle",22,0x000000,0,0,0,0,new SimpleLineSymbol("solid",0xFF0000,0.5,2));
break;
}
case Geometry.POLYLINE:
{
hlGraphic.symbol = new SimpleLineSymbol("solid",0xFF0000,0.3,8);
break;
}
default:
{
hlGraphic.symbol = new SimpleFillSymbol("solid",0x000000,0,new SimpleLineSymbol("solid",0xFF0000,0.4,3));
break;
}
}
//set a glow filter to the highlight graphic
var gf:spark.filters.GlowFilter = new spark.filters.GlowFilter();
gf.color = 0xFF0000;
gf.alpha = 1;
gf.strength = 2;
gf.blurX = 8;
gf.blurY = 8;
hlGraphic.filters = [gf];
//Clear the highlightGraphics graphiclayer and add the new highight graphic
map.layers[glID].clear();
map.layers[glID].add(hlGraphic);
//add eventhandlers to "unhighlight" features
map.infoWindow.closeButton.addEventListener(MouseEvent.CLICK, onInfoWindowClosed);
map.addEventListener(MapMouseEvent.MAP_CLICK, onMapClick)
// --- end addition --------------- And then add a these two functions somewhere: //My handler for clicking closebutton on a popup/infowindow
private function onInfoWindowClosed(event:MouseEvent):void
{
if(hostComponent.map){
for (var i:int = 0; i < hostComponent.map.layerIds.length; i++)
{
if (hostComponent.map.layerIds== "highlightGraphics")
{
hostComponent.map.layers.clear();
}
}
hostComponent.map.infoWindow.closeButton.removeEventListener(MouseEvent.CLICK, onInfoWindowClosed);
}
}
//My handler for a mapclick, mapclicking outside a feature with popup configuration will hide popup/infowindow and clear the highlight graphics.
private function onMapClick(event:MapMouseEvent):void
{
for (var i:int = 0; i < event.map.layerIds.length; i++)
{
if (event.map.layerIds== "highlightGraphics")
{
event.map.layers.clear();
}
}
event.map.infoWindow.hide();
event.map.removeEventListener(MapMouseEvent.MAP_CLICK, onMapClick);
}
... View more
11-29-2011
12:43 AM
|
0
|
0
|
245
|
POST
|
In my flex viewer when a user clicks a feature in an operational layer that has a popup configured, I would like that feature to somehow become highlighted as long as the popup is visible. Does anyone have any ideas on how to make it happen, or on where in the source code I should start trying? Will it be possible changing only the Viewer source code and not the API?
... View more
11-21-2011
11:11 PM
|
0
|
1
|
2058
|
POST
|
What do you mean by OpenLayers WMS services?? OpenLayers is a JavaScript library to build web maps that can dispaly for example WMS Services. It is possible to use WMS Services in ArcGIS for Flex API (and I assume it's possible in the javascript API as well). It might be possible to add a WMS service to a mxd document and publish it in ArcGIS Server (I'm not really sure), but it would be much better to connect directly to the WMS instead of going through ArcGIS Server. I don't think you can use an ArcGIS Server service in OpenLayers (but actually I have no idea because I don't work with OpenLayers) but you can enable the WMS capability on your ArcGIS Server service and use that WMS service in OpenLayers.
... View more
11-18-2011
12:00 AM
|
0
|
0
|
224
|
POST
|
I think you can't change that with the compiled version. I'm using the uncompiled version and found out that I had to change the value of the PageTitel property of <s:Application> in index.mxml, and that value in the source code looks hardcoded to me...
... View more
11-10-2011
03:04 AM
|
0
|
0
|
338
|
POST
|
Hi, I'm not sure if there are any ready to use configurable widgets for this, maybe someone else can answer that? But if you can make your own widget it's possible. There are (at least) two roads to go, one way is to go through ArcGIS Server by creating a connection to the database in ArcMap and publish a service that you can query. The other way (that I'm using my self) is to skip ArcGIS Server and retrieve the data directly into the flex appilcation. There are documentation for this here for example. I'm accessing data in a MySQL database using PHP and httpservices, and then creates a graphic layer from it and add it to the map, works fine!
... View more
10-27-2011
11:18 PM
|
0
|
0
|
224
|
POST
|
Hi, the ArcGIS Viewer for Flex is based on the ArcGIS API for Flex. I don't see how your supposed to use the Viewer for Flex together with the JavaScript API. When you download the Viewer for Flex the API for flex is included, you don't have to download the API separately, just set up the config file with your map services. The Error you're getting "Invalid tile service" might be that your using type="tiled" on a mapservice that isn't cached. Try use type="dynamic" or make sure the mapservice is cached.
... View more
10-27-2011
10:51 PM
|
0
|
0
|
284
|
POST
|
I recently tried Alex Jones python script to convert saved graphics from enhaced Draw Widget to shapefiles. I ran into problems when the script is inserting attribute values, I think it was because the fields are all text fields, but some values are not text strings, so I just made sure they are by using str(). Then it works for me. I also made a tool/script for ArcGIS toolbox, where the user can browse for txt-file, output location and coordinate system and run it in ArcGIS instead of running it from a python ide and using hard coded paths. It makes it a bit easier to use, if anyone is interessted here's the toolbox and script. Just unzip it somewhere and then rightclick in your toolbox and choose add tollbox and point to the tbx file you just unzipped. Thanks to Alex for sharing the script!
... View more
10-04-2011
12:33 AM
|
1
|
0
|
566
|
Title | Kudos | Posted |
---|---|---|
1 | 10-14-2015 01:59 AM | |
1 | 06-13-2024 12:31 AM | |
2 | 03-28-2024 01:07 AM | |
1 | 03-27-2024 04:09 AM | |
1 | 06-13-2024 12:22 AM |
Online Status |
Offline
|
Date Last Visited |
9 hours ago
|