[mapguide-commits] r7496 - in sandbox/jng/createruntimemap: Common/Schema Server/src/Services/Mapping

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed May 15 10:57:17 PDT 2013


Author: jng
Date: 2013-05-15 10:57:17 -0700 (Wed, 15 May 2013)
New Revision: 7496

Added:
   sandbox/jng/createruntimemap/Common/Schema/RuntimeMap-2.6.0.xsd
Modified:
   sandbox/jng/createruntimemap/Server/src/Services/Mapping/ServerMappingService.cpp
Log:
- Add a new RuntimeMap-2.6.0.xsd
- Re-order some elements in the Runtime Map XML generation just to ensure some element consistency with respect to its XML schema

Added: sandbox/jng/createruntimemap/Common/Schema/RuntimeMap-2.6.0.xsd
===================================================================
--- sandbox/jng/createruntimemap/Common/Schema/RuntimeMap-2.6.0.xsd	                        (rev 0)
+++ sandbox/jng/createruntimemap/Common/Schema/RuntimeMap-2.6.0.xsd	2013-05-15 17:57:17 UTC (rev 7496)
@@ -0,0 +1,292 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+  <xs:element name="RuntimeMap">
+    <xs:annotation>
+      <xs:documentation>Describes information about a Runtime Map, so that client applications can interact with it</xs:documentation>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="SiteVersion" type="xs:string">
+          <xs:annotation>
+            <xs:documentation>The MapGuide Site Version</xs:documentation>
+          </xs:annotation>
+        </xs:element>
+        <xs:element name="Name" type="xs:string">
+          <xs:annotation>
+            <xs:documentation>The name of the runtime map. This is the value required for any mapagent operation that require a MAPNAME parameter</xs:documentation>
+          </xs:annotation>
+        </xs:element>
+        <xs:element name="MapDefinition" type="xs:string">
+          <xs:annotation>
+            <xs:documentation>The resource id of the Map Definition from which this runtime map was created from</xs:documentation>
+          </xs:annotation>
+        </xs:element>
+        <xs:element name="BackgroundColor" type="xs:string">
+          <xs:annotation>
+            <xs:documentation>The map's background color in ARGB hex string format</xs:documentation>
+          </xs:annotation>
+        </xs:element>
+        <xs:element name="CoordinateSystem" type="CoordinateSystemType" />
+        <xs:element name="Extents" type="Envelope" />
+        <xs:element name="Group" type="RuntimeMapGroup" minOccurs="0" maxOccurs="unbounded" />
+        <xs:element name="Layer" type="RuntimeMapLayer" minOccurs="0" maxOccurs="unbounded" />
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:complexType name="CoordinateSystemType">
+    <xs:annotation>
+      <xs:documentation>Describes the coordinate system of the runtime map</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="Wkt" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The WKT string of the coordinate system</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="MentorCode" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The CS-Map code of the coordinate system</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="EpsgCode" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The EPSG code of the coordinate system</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="MetersPerUnit" type="xs:double">
+        <xs:annotation>
+          <xs:documentation>The meters-per-unit value of the coordinate system</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="RuntimeMapGroup">
+    <xs:annotation>
+      <xs:documentation>Describes a group of Runtime Map Layers</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="Name" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The name of the group</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Type" type="xs:integer">
+        <xs:annotation>
+          <xs:documentation>The type of this group. Can be tiled or dynamic. Uses the value of MgLayerGroupType</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="LegendLabel" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The group's legend label</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ObjectId" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The group's unique id. Use this value for turning on/off this group in a GETDYNAMICMAPOVERLAYIMAGE request</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ParentId" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>The group's parent group id. Use this value for determining parent-child relationships when building a layer/group hierarchy</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="DisplayInLegend" type="xs:boolean">
+        <xs:annotation>
+          <xs:documentation>Indicates whether this group should be displayed in the legend</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ExpandInLegend" type="xs:boolean">
+        <xs:annotation>
+          <xs:documentation>Indicates whether this group should be initially expanded in the legend</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Visible" type="xs:boolean">
+        <xs:annotation>
+          <xs:documentation>Indicates whether this group is potentially visible. Note that this may be true even though the group is not visible. This will occur if one of the groups this group is organized within is not visible.</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ActuallyVisible" type="xs:boolean">
+        <xs:annotation>
+          <xs:documentation>Indicates the actual visibility of the group. The visibility depends on the visible property of the group, and the visible property of each group this group is organized within.</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="RuntimeMapLayer">
+    <xs:annotation>
+      <xs:documentation>Describes a runtime instance of a Layer Definition</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="Name" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The name of the layer</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Type" type="xs:integer">
+        <xs:annotation>
+          <xs:documentation>The type of this layer. Can be tiled or dynamic. Uses the value of MgLayerType</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="LegendLabel" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The layer's legend label</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ObjectId" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The layer's unique id. Use this value for turning on/off this layer in a GETDYNAMICMAPOVERLAYIMAGE request</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ParentId" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>The layer's parent group id. Use this value for determining parent-child relationships when building a layer/group hierarchy</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="DisplayInLegend" type="xs:boolean">
+        <xs:annotation>
+          <xs:documentation>Indicates whether this layer should be displayed in the legend</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ExpandInLegend" type="xs:boolean">
+        <xs:annotation>
+          <xs:documentation>Indicates whether this layer should be initially expanded (if layer is themed) in the legend</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Visible" type="xs:boolean">
+        <xs:annotation>
+          <xs:documentation>Indicates whether this layer is potentially visible. Note that this may be true even though the layer is not visible. This will occur if the visible flag of one of the groups this layer is organized within is not visible or when the current viewScale property of the map is outside the scale ranges defined for this layer.</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ActuallyVisible" type="xs:boolean">
+        <xs:annotation>
+          <xs:documentation>Indicates the actual visibility of the layer. The visibility depends on the visible property of the group, and the visible property of each group this group is organized within.</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="LayerDefinition" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The Layer Definition from which this runtime layer was created from</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="FeatureSource" type="FeatureSourceInfo" minOccurs="0" />
+      <xs:element name="ScaleRange" type="ScaleRangeInfo" minOccurs="0" maxOccurs="unbounded" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="FeatureSourceInfo">
+    <xs:annotation>
+      <xs:documentation>Describe the Feature Source information for a runtime layer</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="ResourceId" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The Feature Source resource id</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ClassName" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The qualified FDO class name</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Geometry" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The name of the default Geometry property</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="ScaleRangeInfo">
+    <xs:annotation>
+      <xs:documentation>Describes a scale range of the runtime layer</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="MinScale" type="xs:double">
+        <xs:annotation>
+          <xs:documentation>The minimum scale of this scale range</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="MaxScale" type="xs:double">
+        <xs:annotation>
+          <xs:documentation>The maximum scale of this scale range</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Rule" type="RuleInfo" minOccurs="0" maxOccurs="unbounded" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="RuleInfo">
+    <xs:annotation>
+      <xs:documentation>Describes a stylization rule in a layer's scale range</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="GeometryType" type="xs:integer">
+        <xs:annotation>
+          <xs:documentation>The geometry type that this rule is applicable to (1=point, 2=line, 3=area, 4=composite)</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ThemeCategory" type="xs:integer">
+        <xs:annotation>
+          <xs:documentation>The theme category index</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="LegendLabel" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The legend label for this rule</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Filter" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The FDO filter that features must match in order for them to be stylized using this particular rule</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Icon" type="IconInfo" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>Defines the icon for this rule</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="IconInfo">
+    <xs:annotation>
+      <xs:documentation>Describes a layer legend icon</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="MimeType" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The icon's mime type</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Content" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>The icon's image content (in base64 format)</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="Envelope">
+    <xs:annotation>
+      <xs:documentation>Specifies an envelope (a rectangle) using two corner points.</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="LowerLeftCoordinate">
+        <xs:annotation>
+          <xs:documentation>Specifies the lower left corner of the envelope.</xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="X" type="xs:string"/>
+            <xs:element name="Y" type="xs:string"/>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="UpperRightCoordinate">
+        <xs:annotation>
+          <xs:documentation>Specifies the upper right corner of the envelope.</xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="X" type="xs:string"/>
+            <xs:element name="Y" type="xs:string"/>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
\ No newline at end of file

Modified: sandbox/jng/createruntimemap/Server/src/Services/Mapping/ServerMappingService.cpp
===================================================================
--- sandbox/jng/createruntimemap/Server/src/Services/Mapping/ServerMappingService.cpp	2013-05-15 15:35:36 UTC (rev 7495)
+++ sandbox/jng/createruntimemap/Server/src/Services/Mapping/ServerMappingService.cpp	2013-05-15 17:57:17 UTC (rev 7496)
@@ -1910,8 +1910,8 @@
     map->Save(m_svcResource, mapStateId);
 
     //TODO: Possible future caching opportunity?
-    std::string xml;
-    xml.append("<RuntimeMap>\n");
+    std::string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";  // NOXLATE
+    xml.append("<RuntimeMap xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"RuntimeMap-2.6.0.xsd\">\n");
     // ------------------------------ Site Version ----------------------------------//
     xml.append("<SiteVersion>");
     MgServerManager* serverMgr = MgServerManager::GetInstance();
@@ -2107,19 +2107,14 @@
     MG_SERVER_MAPPING_SERVICE_TRY()
 
     xml.append("<Layer>\n");
+    xml.append("<Name>");
+    xml.append(MgUtil::WideCharToMultiByte(layer->GetName()));
+    xml.append("</Name>\n");
     xml.append("<Type>");
     std::string sLayerType;
     MgUtil::Int32ToString(layer->GetLayerType(), sLayerType);
     xml.append(sLayerType);
     xml.append("</Type>\n");
-    xml.append("<LayerDefinition>");
-    Ptr<MgResourceIdentifier> layerDefId = layer->GetLayerDefinition();
-    STRING ldfId = layerDefId->ToString();
-    xml.append(MgUtil::WideCharToMultiByte(ldfId));
-    xml.append("</LayerDefinition>\n");
-    xml.append("<Name>");
-    xml.append(MgUtil::WideCharToMultiByte(layer->GetName()));
-    xml.append("</Name>\n");
     xml.append("<LegendLabel>");
     xml.append(MgUtil::WideCharToMultiByte(MgUtil::ReplaceEscapeCharInXml(layer->GetLegendLabel())));
     xml.append("</LegendLabel>\n");
@@ -2147,6 +2142,11 @@
     xml.append("<ActuallyVisible>");
     xml.append(layer->IsVisible() ? "true" : "false");
     xml.append("</ActuallyVisible>\n");
+    xml.append("<LayerDefinition>");
+    Ptr<MgResourceIdentifier> layerDefId = layer->GetLayerDefinition();
+    STRING ldfId = layerDefId->ToString();
+    xml.append(MgUtil::WideCharToMultiByte(ldfId));
+    xml.append("</LayerDefinition>\n");
     // ----------------------- Optional things if requested ------------------------- //
     if ((requestedFeatures & REQUEST_LAYER_FEATURE_SOURCE) == REQUEST_LAYER_FEATURE_SOURCE)
     {



More information about the mapguide-commits mailing list