コード例 #1
0
ファイル: markupeditor.php プロジェクト: kanbang/Colt
 function AddLineString()
 {
     $geometryFactory = new MgGeometryFactory();
     $agfWriter = new MgAgfReaderWriter();
     $vertices = explode(',', $this->args['GEOMETRY']);
     $count = $vertices[0];
     $coords = new MgCoordinateCollection();
     for ($i = 0; $i < $count; $i++) {
         $coord = $geometryFactory->CreateCoordinateXY((double) $vertices[$i * 2 + 1], (double) $vertices[$i * 2 + 2]);
         $coords->Add($coord);
     }
     $lineString = $geometryFactory->CreateLineString($coords);
     $trans = $this->GetTransform();
     if (null != $trans) {
         $lineString = $lineString->Transform($trans);
     }
     $byteReader = $agfWriter->Write($lineString);
     $propertyValues = new MgPropertyCollection();
     $propertyValues->Add(new MgStringProperty('Text', $this->args['TEXT']));
     $propertyValues->Add(new MgGeometryProperty('Geometry', $byteReader));
     $this->InsertMarkupFeature($propertyValues);
 }
コード例 #2
0
ファイル: measure.php プロジェクト: kanbang/Colt
 if ($units == "ft") {
     $distance *= 3.2808399;
 }
 //get feet
 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);