Example #1
0
             $distance *= 0.3048;
         }
     }
 }
 // Get the map SRS
 //
 $srsFactory = new MgCoordinateSystemFactory();
 $srsDefMap = GetMapSRS($map);
 $mapSrsUnits = "";
 $srsMap = $srsFactory->Create($srsDefMap);
 $arbitraryMapSrs = $srsMap->GetType() == MgCoordinateSystemType::Arbitrary;
 if ($arbitraryMapSrs) {
     $mapSrsUnits = $srsMap->GetUnits();
 }
 //Create/Modify layer definition
 $layerDefContent = BuildLayerDefinitionContent();
 $resourceSrvc->SetResource($layerDefId, $layerDefContent, null);
 if ($layer == null) {
     $newBuffer = true;
     //Targetting a new layer. create a data source for it
     //
     $classDef = new MgClassDefinition();
     $classDef->SetName($featureName);
     $classDef->SetDescription(GetLocalizedString("BUFFERCLASSDESCR", $locale));
     $classDef->SetDefaultGeometryPropertyName("GEOM");
     //Set KEY property
     $prop = new MgDataPropertyDefinition("KEY");
     $prop->SetDataType(MgPropertyType::Int32);
     $prop->SetAutoGeneration(true);
     $prop->SetReadOnly(true);
     $classDef->GetIdentityProperties()->Add($prop);
Example #2
0
         if ($units == "km") {
             $unitText = "DISTANCEKILOMETERS";
         }
         if ($units == "ft") {
             $unitText = "DISTANCEFEET";
         }
         if ($units == "usft") {
             $unitText = "DISTANCEUSFEET";
         }
         if ($units == "m") {
             $unitText = "DISTANCEMETERS";
         }
         $unitText = GetLocalizedString($unitText, $locale);
         $tip = sprintf("Concat(Concat(Concat('" . GetLocalizedString("MEASUREPARTIAL", $locale) . ": ', PARTIAL), Concat(', " . GetLocalizedString("MEASURETOTAL", $locale) . ": ', TOTAL)), ' (%s)')", $unitText);
         //Create the layer definition
         $layerDefContent = BuildLayerDefinitionContent($dataSource, $featureName, $tip);
         $resourceSrvc->SetResource($layerDefId, $layerDefContent, null);
     } else {
         //data source already exist. clear its content
         ClearDataSource($featureSrvc, $dataSourceId, $featureName);
     }
     //Add the layer to the map, if it's not already in it
     if ($layer == null) {
         $legendName = GetLocalizedString("MEASURELAYER", $locale);
         $layer = new MgLayer($layerDefId, $resourceSrvc);
         $layer->SetDisplayInLegend(true);
         $layer->SetLegendLabel($legendName);
         $layers->Insert(0, $layer);
     }
 }
 // create a feature representing this segment and insert it into the data source