您的位置:首页 > 其它

Geometry 对象浅析

2007-04-19 14:31 232 查看
作者:Flyingis

ArcEngine Geometry库定义了基本几何图形的矢量表达形式,顶级的几何图形有Points、Multipoints、Polylines、Polygons、 Multipatches,Geodatabase和绘图系统使用这些几何图形来定义其他各种形状的特征和图形,提供了编辑图形的操作方法和地图符号系统符号化特征数据的途径。

Geometry库中几个核心类和接口构成了Geometry对象的基本框架。

GeometryEnvironment

GeometryEnvironment提供了从不同的输入、设置或获取全局变量来创建几何图形的方法,以便控制geometry方法的行为。GeometryEnvironment对象是一个单例对象。

public IPolyline TestGeometryEnvironment()
private IPolygon GeometryBag_Example(IFeatureClass featureClass)
public IPolyline ConstructMultiPartPolyline(IPolyline inputPolyline)
public IMultiPatch CreateMultipatch()
{
//Prepare the geometry material list.
IGeometryMaterial texture = new GeometryMaterialClass();
texture.TextureImage = "C:\\Temp\\MyImage.bmp";

IGeometryMaterialList materialList = new GeometryMaterialListClass();
materialList.AddMaterial(texture);

//Create the multipatch.
IGeneralMultiPatchCreator multiPatchCreator = new GeneralMultiPatchCreatorClass();
multiPatchCreator.Init(4, 1, false, false, false, 4, materialList);

//Set up part.

//Could also use a Ring or a TriangleFan.
multiPatchCreator.SetPatchType(0, esriPatchType.esriPatchTypeTriangleStrip);
multiPatchCreator.SetMaterialIndex(0, 0);
multiPatchCreator.SetPatchPointIndex(0, 0);
multiPatchCreator.SetPatchTexturePointIndex(0, 0);

//Set real-world points.
WKSPointZ upperLeft = new WKSPointZ();
WKSPointZ lowerLeft = new WKSPointZ();
WKSPointZ upperRight = new WKSPointZ();
WKSPointZ lowerRight = new WKSPointZ();

upperLeft.X = 0;
upperLeft.Y = 0;
upperLeft.Z = 0;
upperRight.X = 300;
upperRight.Y = 0;
upperRight.Z = 0;
lowerLeft.X = 0;
lowerLeft.Y = 0;
lowerLeft.Z = -100;
lowerRight.X = 300;
lowerRight.Y = 1;
lowerRight.Z = -100;

multiPatchCreator.SetWKSPointZ(0, ref upperRight);
multiPatchCreator.SetWKSPointZ(1, ref lowerRight);
multiPatchCreator.SetWKSPointZ(2, ref upperLeft);
multiPatchCreator.SetWKSPointZ(3, ref lowerLeft);

//Set texture points.
//Set the texture coordinates for a panel.
WKSPoint textureUpperLeft = new WKSPoint();
WKSPoint textureLowerLeft = new WKSPoint();
WKSPoint textureUpperRight = new WKSPoint();
WKSPoint textureLowerRight = new WKSPoint();

textureUpperLeft.X = 0;
textureUpperLeft.Y = 0;
textureUpperRight.X = 1;
textureUpperRight.Y = 0;
textureLowerLeft.X = 0;
textureLowerLeft.Y = 1;
textureLowerRight.X = 1;
textureLowerRight.Y = 1;

multiPatchCreator.SetTextureWKSPoint(0, ref textureUpperRight);
multiPatchCreator.SetTextureWKSPoint(1, ref textureLowerRight);
multiPatchCreator.SetTextureWKSPoint(2, ref textureUpperLeft);
multiPatchCreator.SetTextureWKSPoint(3, ref textureLowerLeft);
IMultiPatch multiPatch = multiPatchCreator.CreateMultiPatch() as IMultiPatch;

return multiPatch;
}
参考资料:ArcEngine 9.2帮助文档
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: