The MgLayer instance actually keeps a copy of the ScaleRange values.
I assume that this is used to select what layers to render and speed up the process.
Unfortunately there are no relevant properties exposed on the MgLayer class,
so you cannot change the values.

Instead, you can create a new MgLayer instance, and copy all the properties from
the original MgLayer to the new MgLayer.
Then remove the original MgLayer and insert the new one in the same position as
the previous one.

You should file a bug report stating that the scale ranges cannot be refreshed from the API.

If you use the MaestroAPI, the values are exposed as a an array of doubles, and thus modify-able.

Regards, Kenneth Skovhede, GEOGRAF A/S



SriRam007 skrev:
Hi Kenneth,

I m trying with the Sheboygan

+Sheboygan
    +Layers
       . Buildings
       . CityLimits
       . Roads

Here road layer is having Scale ranges like Range From To ------------------------- 1 0 10000 2 10000 24000
Am showing all the ranges to let the user edit at runtime . And changing
scale below 24000 is working but beyond 24000 it is not working.

And its XML file is like below. And I am changing the bold line
<?xml version="1.0" encoding="UTF-8"?>
<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xsi:noNamespaceSchemaLocation="LayerDefinition-1.3.0.xsd" version="1.3.0">
  <VectorLayerDefinition>
<ResourceId>Library://Samples/Sheboygan/Data/RoadCenterLines.FeatureSource</ResourceId>
    <FeatureName>SHP_Schema:RoadCenterLines</FeatureName>
    <FeatureNameType>FeatureClass</FeatureNameType>
    <Geometry>SHPGEOM</Geometry>
    <VectorScaleRange>
      <MaxScale>10000</MaxScale>      <LineTypeStyle>
        <LineRule>
          <LegendLabel>
          </LegendLabel>
          <Label>
            <Unit>Points</Unit>
            <SizeContext>DeviceUnits</SizeContext>
            <SizeX>0</SizeX>
            <SizeY>8</SizeY>
            <Text>"NAME"</Text>
            <FontName>Verdana</FontName>
            <ForegroundColor>FF000000</ForegroundColor>
            <BackgroundColor>FFFFFFFF</BackgroundColor>
            <BackgroundStyle>Transparent</BackgroundStyle>
            <HorizontalAlignment>'Center'</HorizontalAlignment>
            <VerticalAlignment>'Baseline'</VerticalAlignment>
            <AdvancedPlacement>
              <ScaleLimit>0.5</ScaleLimit>
            </AdvancedPlacement>
          </Label>
          <LineSymbolization2D>
            <LineStyle>Solid</LineStyle>
            <Thickness>0.5</Thickness>
            <Color>FFFF00FF</Color>
            <Unit>Millimeters</Unit>
            <SizeContext>DeviceUnits</SizeContext>
          </LineSymbolization2D>
        </LineRule>
      </LineTypeStyle>
    </VectorScaleRange>
    <VectorScaleRange>
      <MinScale>"10000"</MinScale>
      <MaxScale>24000</MaxScale>
      <LineTypeStyle>
        <LineRule>
          <LegendLabel>
          </LegendLabel>
          <LineSymbolization2D>
            <LineStyle>Solid</LineStyle>
            <Thickness>0.5</Thickness>
            <Color>FF808080</Color>
            <Unit>Millimeters</Unit>
            <SizeContext>DeviceUnits</SizeContext>
          </LineSymbolization2D>
        </LineRule>
      </LineTypeStyle>
    </VectorScaleRange>
  </VectorLayerDefinition>
</LayerDefinition>



After modification my XML file :::

 Range       From     To        style(BK color)
 ------------------------------------------
 1            0            11000    Pink
 2            11000      25000    Green

<?xml version="1.0" encoding="UTF-8"?>
<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xsi:noNamespaceSchemaLocation="LayerDefinition-1.3.0.xsd" version="1.3.0">
  <VectorLayerDefinition>
<ResourceId>Library://Samples/Sheboygan/Data/RoadCenterLines.FeatureSource</ResourceId>
    <FeatureName>SHP_Schema:RoadCenterLines</FeatureName>
    <FeatureNameType>FeatureClass</FeatureNameType>
    <Geometry>SHPGEOM</Geometry>
    <VectorScaleRange>
      <MiniScale>0</MiniScale>
      <MaxScale>11000</MaxScale>      <LineTypeStyle>
        <LineRule>
          <LegendLabel>
          </LegendLabel>
          <Label>
            <Unit>Points</Unit>
            <SizeContext>DeviceUnits</SizeContext>
            <SizeX>0</SizeX>
            <SizeY>8</SizeY>
            <Text>"NAME"</Text>
            <FontName>Verdana</FontName>
            <ForegroundColor>FF000000</ForegroundColor>
            <BackgroundColor>FFFFFFFF</BackgroundColor>
            <BackgroundStyle>Transparent</BackgroundStyle>
            <HorizontalAlignment>'Center'</HorizontalAlignment>
            <VerticalAlignment>'Baseline'</VerticalAlignment>
            <AdvancedPlacement>
              <ScaleLimit>0.5</ScaleLimit>
            </AdvancedPlacement>
          </Label>
          <LineSymbolization2D>
            <LineStyle>Solid</LineStyle>
            <Thickness>0.5</Thickness>
            <Color>FFFF00FF</Color>
            <Unit>Millimeters</Unit>
            <SizeContext>DeviceUnits</SizeContext>
          </LineSymbolization2D>
        </LineRule>
      </LineTypeStyle>
    </VectorScaleRange>
    <VectorScaleRange>
      <MinScale>"11000"</MinScale>
      <MaxScale>25000</MaxScale>
      <LineTypeStyle>
        <LineRule>
          <LegendLabel>
          </LegendLabel>
          <LineSymbolization2D>
            <LineStyle>Solid</LineStyle>
            <Thickness>0.5</Thickness>
            <Color>FF808080</Color>
            <Unit>Millimeters</Unit>
            <SizeContext>DeviceUnits</SizeContext>
          </LineSymbolization2D>
        </LineRule>
      </LineTypeStyle>
    </VectorScaleRange>
  </VectorLayerDefinition>
</LayerDefinition>

And i m saving like
resourceService.SetResource(layerResId, new MgByteReader(layerDefinition,
"text/xml"), null);
            layer.SetLayerDefinition(layerResId, resourceService);
            map.Save(resourceService);
then refreshing the map by mapFrame.Refresh();


But the second range is visible upto 24000.
If i will give below 24000 instead of beyond 24000 then everything is
working Layer is showing with its style (0 - 11000 :Pink color And 11000 - 24000 (Or below) : Green Color is showing) for the respective ranges.

thanks










_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to