ArcGIS geometry object

Source: Internet
Author: User
Tags polyline ipoint

Geometry is one of the most widely used object sets in ArcGIS Engine. When you create, delete, edit, and perform geographic analysis, you are processing a vector object containing ry; except for display element accidents, geometry is required for control object selection, element symbolic, annotation element, and editing element. Figure 1 shows the main geometric object model of geometry. The following describes these geometric objects one by one.

Geometric object
Point: a zero-dimensional geometric chart with X and Y coordinate values and optional attributes, such as elevation value (z value), measurement value (m value), and ID number, point object is used to describe objects that are precisely located.

Multipoint: A Point Set object is a cluster of unordered points with the same attribute information. For example, you can use a single vertex set to represent the whole city's Natural Gas Regulator Station.

The following code snippet demonstrates how to build a multipoint object:

// Define the first Vertex

Ipoint ppoint1 = new pointclass ();
Ppoint1.x = 100;
Ppoint1.y= 100;

 

// Define the second Vertex

Ipoint ppoint2 = new pointclass ();

Ppoint2.x = 200;
Ppoint2.y = 200;

...... // Construct other points

Ipointcollection pmultipoint = new multipointclass ();

Object o = type. missing;

// Add the first vertex. You do not need to set the order of the vertex. The parameter is set to type. Missing.

Pmultipoint. addpoint (ppoint1, ref o, ref O );

// Add the second vertex. You do not need to set the order of the vertex. The parameter is set to type. Missing.

Pmultipoint. addpoint (ppoint2, ref o, ref O );
...... // Add other points
Segment geometric object


PATH is a set of consecutive segment. Except for the first segment and last segment of the path, the start point of the other segment is the end point of the previous segment, that is, the segment in the path object cannot be separated. The path can be a combination of any number of lines, circulararc, ellipticarc, and beziercurve.
One or more paths form a Polyline Object.
 The ring is a closed path, that is, the start and end points have the same coordinate values. It has internal and external attributes.

One or more Ring Objects form a polygon object.

A Polyline Object is an ordered set of one or more connected or unconnected path objects. It can be composed of a single path object or multiple connected path objects, or multiple separated paths, as shown in. Polyline is usually used to represent linear objects such as roads, rivers, pipelines, etc.

A Polyline Object must meet the following criteria:
1. All path objects that constitute a Polyline Object must be valid.
2. All path objects that constitute a Polyline Object cannot overlap, overlap, or self-intersection.
3. Multiple Path objects that constitute a polyline object can be connected to or separated from a certain point.
4. The length of the path object cannot be 0.
Ipolympus is the main interface of the polyline class. The reshape method of ipolympus can use a path object to form an integer of A Polyline Object. The simplifynetwork method of ipolympus is used to simplify the network.
You can use the igeometrycollection interface to add a path object to a Polyline Object. Note the following when using this interface:
1. Each path object must be valid, or be valid after the ipath: simplify method is used.
2. Because polyline is an ordered set of path objects, you must pay attention to the order and direction when adding a path object.
3. To ensure that polyline is valid, you can use the simplify method of the itopologicaloperator interface after creating a Polyline Object.
The following code snippet creates a Polyline Object using the igeometrycollection interface:

// Define the first Vertex

Ipoint ppoint1 = new pointclass ();
Ppoint1.x = 100;
Ppoint1.y= 100;

// Define the second Vertex

Ipoint ppoint2 = new pointclass ();
Ppoint2.x = 200;

Ppoint2.y = 200;

// Create a line Object

Iline pline = new lineclass ();

// Set the start and end point of the line Object

Pline. putcoords (ppoint1, ppoint2 );

// Qi to isegment

Isegment required gment = pline as isegment;

// Create a path object

Segmentcollection ppath = new pathclass ();

Object o = type. missing;

// Add a segment object for the path object through the isegmentcollection Interface

Ppath. addsegment (gradient gment, ref o, ref O );

// Create a Polyline Object

Igeometrycollection ppolyline = new polylineclass ();

// Use igeometrycollection to add a path object for a Polyline Object

Ppolyline. addgeometry (ppath as igeometry, ref o, ref O );
The 2polylgon object is an ordered set of one or more ring objects. It can be composed of a single ring object or multiple rings, as shown in. The ring can be divided into the outer ring and the inner ring. Both the outer ring and the inner ring have a direction. The difference between them is that the direction of the outer ring is clockwise and the direction of the inner ring is clockwise. Polygon is usually used to represent an area of polygon vector objects, such as administrative districts and buildings.

The following code snippet demonstrates how to build a polygon:

// Create a ring object and add a segment object to it through the isegmentcollection Interface

Isegmentcollection extends gcollection = new ringclass ();

Object o = type. missing;

Required gcollection. addsegment (required gment1, ref o, ref O );

Required gcollection. addsegment (required gment2, ref o, ref O );

// The Qi to iring interface closes the ring object to make it valid

Iring Pring = cancgcollection as iring;

Pring. Close ();

// Construct a polygon object using the ring object

Igeometrycollection pgeometrycoll = new polygonclass ();

Pgeometrycoll. addgeometry (Pring, ref o, ref O );
Envelope is an external rectangle of all geometric objects. It is used to represent the smallest border of a geometric object. All geometric objects have an envelope object. ienvelope is the main interface of an envelope object, you can obtain the xmax, xmin, Ymax, ymin, height, and width attributes of geometric objects. The expand method of ienvelope can also scale the range of the envelope object proportionally.

 

 

6 curve object ry object
    All other ry except point, multipoint, and envelope can be seen as curve ). Line, polyline, polygon, circulararc, beziercurve, ellipticarc, and circulararc are both curves that implement the icurve interface.
The Length attribute of the icurve interface is used to return the length of a curve object.
The frompoint and topoint attributes of the icurve interface can obtain the starting and ending points of the curve object.
The reverseorientation method of the icurve interface can change the node sequence of a curve object, that is, the starting point and ending point of the curve object are changed to each other.
The isclosed attribute of the icurve interface determines whether a curve object's start point and end point are in the same position.
The getsubcurve method of the icurve interface can copy a specific part of a curve object, for example, a curve object of Highway 10 km. The following shows the code snippet for obtaining the curve at Highway 2-5 km:

// Qi to icurve Interface

Icurve pcurve = ppolyline as icurve;

// Create a Polyline Object

Icurve pnewcurve = new polylineclass ();

Bool btrue = true;

// Obtain the curve object between 5 km and

Pcurve. getsubcurve (2, 5, btrue, out pnewcurve );

In addition, the querytangent and querynormal methods of icurve are used to obtain the tangent and normal of a curve at a certain point on the curve object respectively.

2.4.7 triangle strip and trangle fan, trangle, and ring geometric objects
Triangle strip and trangle fan, trangle, and ring are the building objects that constitute multipatch geometric objects.
2.4.7.1triangle strip geometric object
A triangelstrip object is composed of a series of surface slices defined by points, and a surface slice is composed of several triangles. Therefore, this surface can be defined as: (0, 1, 2), (2, 1, 3), (2, 3, 4), (4, 3, 5 ).
2 trangle fan ry object
A trangle fan object consists of a series of surface slices defined by points. The difference is that all triangles share a vertex. As shown in, this surface can be defined as: (0, 1, 2), (0, 2, 3), (0, 4, 5 ).
3triangle geometric object
Triangle is determined by three points. For example, a triangle can be defined as (0, 1, 2.
4ring geometric object
The ring is the same as the ring composed of polygon introduced by the front. For example, the wall of a house below is an outring object, while the window and door are innerring objects.

8multipatch geometric object
Multipatch geometric objects are used to describe 3D images. They can be composed of trianglestrip, trianglefan, triangle, and ring objects. Multipatch can be created in multiple ways. One is to import an external 3D data file (3D Studio Max. 3DS files, OpenFlight. flt files, Collada. dae files, sketchup. SKP files, fig. in addition, ArcGIS Engine provides a variety of methods to create multipatch geometric objects:
If you create a multipatch with no texture, no direction, and no component information, you only need to create each part of the multipatch, then add the components through the igeometrycollection interface of multipatch.
If you want to add texture information and forward information for each component of multipatch, generalmultipatchcreator must be used for attribute information.The igeneralmultipatchinfo interface is used to define the direction, material, and attribute information for each component of multipatch. The igeneralmultipatchinfo interface can be used to obtain information about each component of the multipatch.
You can use the iconstructmultipatch interface and iextrude interface to operate a geometryenvironment object. You can create a multipatch by stretching a Polyline Object (stretched as a wall) and a polygon object (stretched as a Polyline Object.
By accessing the 3D symbol library, get the 3dsymbol to render the point, place the 3D symbol in the position of the point to generate a multipatch.
Next we will introduce you through generalmultipatchcreatorTo create a multipatch with textures, you must use the following three objects:
Geometrymaterial: used to build materials. Materials created using igeometrymaterial can be used to create these symbols as the texturelinesymbol or texturefillsymbol attribute, or they can be added to geometrymateriallist objects for generalmultipatchcreatorObject To build a multipatch object.
Geometrymateriallist: the material object container is used for generalmultipatchcreatorUsed when the object calls the init method.
Generalmultipatchcreator: Used to create multipatch with textures ..
9geometry collection Interface
According to the introduction of the specific geometry object on the front side, except for the point object, other geometric objects are constructed through other geometric object sets. For example, a multipoint object is a set of points, a path object is a set of segment objects, a Polyline Object is a set of path objects, and a polygon object is a set of ring objects, multipatch objects are a set of triangle strip and trangle fan, trangle, and ring objects.
ArcGIS Engine provides three main geometric image collection interfaces for operations on geometric objects: ipointcollection, isegmentcollection, and igeometrycollection, these interfaces reveal the essence of ArcGIS Engine's geometric model-they are a combination of a pattern that is not necessarily organized according to a strict hierarchy.
When we introduced some geometric objects, we also demonstrated some functions. These three interfaces are often used in program development, the following describes how to use these three interfaces.
2.4.9.1igeometrycollection interface the igeometrycollection interface is implemented by polygon, polyline, multipoint, multipatch, trangle, t rangle strip, trangle fan, and geometrybag. The igeometrycollection interface allows developers to add, change, and remove a child object as an element of a geometric object. For example:
The sub-object that makes up a Polyline Object is a path object.
The sub-object that makes up a polygon object is a ring object.
The child object that makes up a multipoint object is a point object.
The sub-objects that comprise multipatch objects are tranglefan tranglestrip, triangle, or ring objects.
A geometrybag object is a rybag object of any type. In fact, geometrybag is a container that can hold any type of geometric objects.
The geometry attribute of the igeometrycollection can return a sub-object that makes up the ry object through an index value, while geometrycount returns the number of sub-objects that make up the geometric object.
The addgeometry and addgeometries methods of igeometry are used to add sub-objects to a geometric object. The difference between them is that the former can only add one geometric object at a time, while the latter can add one array of geometric objects at a time. In addition, the addgeometry method can add sub-objects to the specified index value location of the ry, while the addgeometries method adds the sub-object array to the end of the set.
When addgeometry is used to add sub-objects to a polygon object, if the Sub-object is covered by the ring, the polygon is not closed or contains the relations. Therefore, this polygon is not a simple polygon, therefore, when creating a polygon using igometrycollection, you must use the simplify method of itopologicaloperator to ensure its effectiveness.
. 4.9.2isegmentcollection Interface
The isegmentcollection interface is implemented by four classes: path, ring, polyline, and polygon. They are called Segment Set objects. You can use this interface to process each sub-segment object in the segment set object. You can use the isegmentcollection interface to add, insert, and delete segment sub-objects for a segment collection object. The setcircle and setrectangle methods of isegmentcollection interfaces provide a simple method to build a complete path, ring, polyline, and polygon without adding a segment.
2.4.9.3ipointcollection Interface
Ipointcollection can be implemented by multiple geometric object classes. These objects are composed of multiple points, such as mullipoint, path, ring, polyline, polygon, trianglefan, tranglestrip, trangle, and multipatch, they can all be called pointcollection objects. They can be obtained, added, inserted, queried, and removed from a certain vertex in the geometric object through the methods defined by the ipointcollection interface. Like the above two interfaces, it also defines a method to operate on a vertex set object. For example, you can use the addpoint method to add a vertex object to a specific index bit in the pointcollection object. If no position is specified, then add it to the end. You can use the point attribute of ipointcollection to obtain a vertex through the vertex index.
The demo at the end of this section demonstrates the functions provided by ipointcollection.
2.4.10 Summary of geometric objects
There are two types of geometric objects in the geometry model. One is an advanced geometric object, which is used to directly construct elements, the following table lists the first type of geometric objects used to construct high-level geometric objects with a lower level:

Geometric Object Name Category Create a child geometric object Interfaces for creating and editing
Polyline Advanced Path Igeometrycollection,
Ipointcollection
Polygon Advanced Ring Igeometrycollection,
Ipointcollection
Multipoint Advanced Point Igeometrycollection,
Ipointcollection
Multipatch Advanced Tranglefan, ring tranglestrip, trangle, Igeometrycollection,
Ipointcollection
Ring Low Level Segment Isegmentcollection,
Ipointcollection
Path Low Level Segment Isegmentcollection,
Ipointcollection
Segment Low Level Point Ipoint, iline, icurve
Trianglefan Low Level Point Igeometrycollection,
Ipointcollection
Trianglestrip Low Level Point Igeometrycollection,
Ipointcollection
Triangle Low Level Point Igeometrycollection,
Ipointcollection
Point Advanced/low-level None Ipoint

 

 

 

 

 

Http://blog.sina.com.cn/s/blog_5d25ac4e0100k47r.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.