示例#1
0
function GetLayerTypes($featureService, $layer)
{
    $aLayerTypes = array();
    try {
        $dataSourceId = new MgResourceIdentifier($layer->GetFeatureSourceId());
        if ($dataSourceId->GetResourceType() != MgResourceType::DrawingSource) {
            //get class definition from the featureSource
            $classDefinition = GetFeatureClassDefinition($featureService, $layer, $dataSourceId);
            //MgPropertyDefinition classProps
            $classProps = $classDefinition->GetProperties();
            $aLayerTypes = 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, '2');
                    }
                    if ($featureClass & MgFeatureGeometricType::Curve) {
                        array_push($aLayerTypes, '1');
                    }
                    if ($featureClass & MgFeatureGeometricType::Solid) {
                        array_push($aLayerTypes, '3');
                        //could use surface here for editing purposes?
                    }
                    if ($featureClass & MgFeatureGeometricType::Point) {
                        array_push($aLayerTypes, '0');
                    }
                    break;
                } else {
                    if ($prop->GetPropertyType() == MgFeaturePropertyType::RasterProperty) {
                        array_push($aLayerTypes, '4');
                    }
                }
            }
        } else {
            array_push($aLayerTypes, '5');
        }
    } catch (MgException $e) {
    }
    return $aLayerTypes;
}
示例#2
0
    *****************************************************************************/
 /*****************************************************************************
    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');
         } else {
             if ($featureClass & MgFeatureGeometricType::Curve) {
                 array_push($aLayerTypes, 'curve');
             } else {