Example #1
0
    TODO: check user permissions to edit the resource
    *****************************************************************************/
 /*****************************************************************************
    get the layer's geometric type(s)
    *****************************************************************************/
 /*****************************************************************************
    get the layer's attributes and types
    *****************************************************************************/
 $attributes = GetFeatureSourceAttributes($map, $layer->GetLayerDefinition(), $featureService);
 /*****************************************************************************
    determine whether a shadow feature source has been created for the layer
    *****************************************************************************/
 // convert the feature resource for the selected layer to the shadow version
 $shadowResourceId = CreateSessionResourceId($dataSourceId, '-shadow');
 $hasShadow = 'false';
 if (DataSourceExists($resourceService, $shadowResourceId)) {
     $hasShadow = 'true';
 }
 //get class definition from the featureSource
 $classDefinition = GetFeatureClassDefinition($featureService, $layer, $dataSourceId);
 //MgPropertyDefinition classProps
 $classProps = $classDefinition->GetProperties();
 $featureGeometryName = $layer->GetFeatureGeometryName();
 $aLayerTypes = array();
 $aProperties = array();
 for ($i = 0; $i < $classProps->GetCount(); $i++) {
     $prop = $classProps->GetItem($i);
     if ($prop->GetPropertyType() == MgFeaturePropertyType::GeometricProperty) {
         $featureClass = $prop->GetGeometryTypes();
         if ($featureClass & MgFeatureGeometricType::Surface) {
             array_push($aLayerTypes, 'surface');
Example #2
0
 if ($units == "usft") {
     $distance *= 3.2808333;
 }
 //get US survey feet
 $total += $distance;
 //create the line string geometry representing this segment
 //
 $geomFactory = new MgGeometryFactory();
 $coordinates = new MgCoordinateCollection();
 $coordinates->Add($geomFactory->CreateCoordinateXY($x1, $y1));
 $coordinates->Add($geomFactory->CreateCoordinateXY($x2, $y2));
 $geom = $geomFactory->CreateLineString($coordinates);
 if ($segId == 1) {
     //first segment
     //
     if (!DataSourceExists($resourceSrvc, $dataSourceId)) {
         //create feature source
         //
         $classDef = new MgClassDefinition();
         $classDef->SetName($featureName);
         $classDef->SetDescription(GetLocalizedString("MEASUREFEATURECLASS", $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);
         $classDef->GetProperties()->Add($prop);
         //Set PARTIAL property. Hold the distance for this segment
         $prop = new MgDataPropertyDefinition("PARTIAL");