
Public Type EraseTargetfeatureinfoCount As IntegerLayername As StringTargetKeys() As StringEnd TypeOption ExplicitDim x1 As Double,y1 As Double,x2 As Double,y2 As DoubleDim eraseTargetFeature As EraseTargetfeatureinfoDim ftrcopyInfo As FeaturecopyInfoPrivate Sub Combine_Click()Dim ftr As MapXlib.FeatureDim ftrs As MapXlib.FeaturesDim ftrCombined As MapXlib.FeatureDim styCombined As MapXlib.StyleDim ftrType As MapXlib.FeatureTypeConstantsDim intFtrCount As IntegerintFtrCount = Map1.Layers("USA").Selection.CountIf intFtrCount > 0 ThenSet ftrs = Map1.Layers("USA").SelectionftrType = ftrs(1).TypeFor Each ftr In ftrsIf ftr.Type <> ftrType ThenMsgBox "不能合并不同类型对象!",vbOKOnly + vbExclamationExit SubEnd IfNextSet ftrCombined = Map1.Layers("USA").AddFeature(Map1.FeatureFactory.CombineFeatures(ftrs))Set styCombined = ftrs(1).Style.CloneftrCombined.Style = styCombinedftrCombined.UpdateFor Each ftr In ftrsMap1.Layers("USA").DeleteFeature ftrNextMap1.Layers("USA").Selection.Replace ftrCombinedEnd IfEnd SubPrivate Sub Eraser_Click()Dim ftrEraser As MapXlib.FeatureDim ftrNewTarget As MapXlib.FeatureDim ftroldTarget As MapXlib.FeatureDim styoldTarget As MapXlib.StyleDim bInTargeterased As BooleanDim intCount As IntegerDim i As IntegerintCount = 0For i = 1 To eraseTargetFeature.CountSet ftroldTarget = Map1.Layers("USA").GetFeatureByKey(eraseTargetFeature.TargetKeys(i))Set styoldTarget = ftroldTarget.Style.CloneSet ftrNewTarget = ftroldTarget.ClonebInTargeterased = FalseFor Each ftrEraser In Map1.Layers("USA").SelectionIf ftrEraser.Type = miFeatureTypeRegion ThenIf Map1.FeatureFactory.IntersectionTest(ftrNewTarget,ftrEraser,miIntersectFeature) ThenSet ftrNewTarget = Map1.FeatureFactory.EraseFeature(ftrNewTarget,ftrEraser)bInTargeterased = TrueEnd IfEnd IfNextNextIf bInTargeterased ThenSet ftrNewTarget = Map1.Layers.InsertionLayer.AddFeature(ftrNewTarget)Set ftrNewTarget.Style = styoldTargetftrNewTarget.UpdateMap1.Layers.InsertionLayer.DeleteFeature ftroldTargetEnd IfEnd SubPrivate Sub EraseTarget_Click()Dim ftr As MapXlib.FeatureDim intFtrCount As IntegerintFtrCount = 0For Each ftr In Map1.Layers("USA").SelectionIf (ftr.Type = miFeatureTypeRegion) Or (ftr.Type = miFeatureTypeline) ThenintFtrCount = intFtrCount + 1ReDim Preserve eraseTargetFeature.TargetKeys(1 To intFtrCount)eraseTargetFeature.TargetKeys(intFtrCount) = ftr.FeatureKeyEnd IfNexteraseTargetFeature.Count = intFtrCounteraseTargetFeature.Layername = Map1.Layers("USA").nameEnd SubPrivate Sub Intersect_Click()Dim ftrIntersection As MapXlib.FeatureDim ftrs As MapXlib.FeaturesDim ftr As MapXlib.FeatureDim intFtrCount As IntegerintFtrCount = Map1.Layers("USA").Selection.CountIf intFtrCount > 0 ThenSet ftrs = Map1.Layers.InsertionLayer.SelectionSet ftrIntersection = Map1.FeatureFactory.IntersectFeatures(ftrs)Set ftrIntersection = Map1.Layers.InsertionLayer.AddFeature(ftrIntersection)ftrIntersection.Style = ftrs(1).Style.CloneftrIntersection.UpdateFor Each ftr In ftrsMap1.Layers("UAS").DeleteFeature ftrNextMap1.Layers.InsertionLayer.Selection.Replace ftrIntersectionEnd IfEnd SubPrivate Sub Label_Click()Map1.CurrentTool = miLabelToolEnd SubPrivate Sub Form_Load()//确定编辑层Dim lyrInsertion As MapXlib.LayerSet lyrInsertion = Map1.Layers("USA")lyrInsertion.Editable = TrueSet Map1.Layers.InsertionLayer = lyrInsertionEnd Sub 总结 以上是内存溢出为你收集整理的MapX的一个VB例子全部内容,希望文章能够帮你解决MapX的一个VB例子所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)