IIRC, IsVisible() is the same as GetVisible(), which is a property that determines if the layer is visible. If the layer is "visible", it will be displayed, but only appears in the map at predefined scale ranges.

The scale ranges are actually present in the layer object, but not accesible from the API. You have to read out the LayerDefinition ResourceIdentifier, load the xml from the LayerDefinition, and find the <VectorScaleRange> tags:
 <VectorScaleRange>
     <MinScale>0</MinScale>
     <MaxScale>100</MaxScale>
</VectorScaleRange>

Be aware that both <MinScale> and <MaxScale> may be missing, in which case they are 0 and inifinite respectively.

Regards, Kenneth Skovhede, GEOGRAF A/S



Lukas Hybner skrev:
Hi all,

I have a problem when I show tree of layers. I need to know if the layer
is Visible or not.
For Example client send scale=5000000 and some layers is visible from 1
to 4000. When I want to know if the layers is visible, I use method
isVisible(). This method return always true because map.getViewScale()
returns 1.0 (not 5000000).

My code is (in jsp):

String mapDefinition = "some map definition";
MgMap map = new MgMap();
MgResourceIdentifier resId = new MgResourceIdentifier(mapDefinition);
String mapName = resId.GetName();
map.Create(resourceSrvc, resId, mapName);

MgGeometryFactory factory = new MgGeometryFactory();
MgCoordinate centerCoord = factory.CreateCoordinateXY(centerx,centery);

//here is scale property from client
MgByteReader mgImage = renderingSrvc.RenderMap( map, null, centerCoord,
scale,width, height, color, "JPG" );

out.println(map.GetViewScale()); //returns 1.0

MgLayerCollection layers = map.GetLayers();
for (int i = 0; i < layers.GetCount(); ++i)
        out.println( (layers.GetItem(i).isVisible ? "on" : "off") );
//this write on


How can I change scale in object map? Or is some other solution? Or can
I read from layer object min and max scale?

Lukas Hybner


_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to