コード例 #1
0
        /// <summary>
        /// ����¼�
        /// </summary>
        public override void OnClick()
        {
            DataEditCommon.g_pAxMapControl.CurrentTool = null;

            IMap pMap = m_hookHelper.FocusMap;
            UID puid = new UID();
            puid.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";//IFeatureLayer
            IEnumLayer enumLayer = pMap.get_Layers(puid, true);
            enumLayer.Reset();
            ILayer player;
            player = enumLayer.Next();
            IFeatureLayer featureLayer = null;
            while (player != null)
            {
                featureLayer = player as IFeatureLayer;
                IFeatureLayerDefinition featureLayerDef = featureLayer as IFeatureLayerDefinition;
                string sWhereClause = "";//����ɸѡ����
                featureLayerDef.DefinitionExpression = sWhereClause;

                player = enumLayer.Next();
            }

            m_hookHelper.ActiveView.Extent = m_hookHelper.ActiveView.FullExtent;
            m_hookHelper.ActiveView.Refresh();
        }
コード例 #2
0
ファイル: WorkspaceOperator.cs プロジェクト: secondii/Yutai
        // Methods
        public static IFeatureClass CreateAnnoFeatureClass(string string_0, IFeatureDataset ifeatureDataset_0,
                                                           double double_0)
        {
            IObjectClassDescription  description  = new AnnotationFeatureClassDescription();
            IFeatureClassDescription description2 = (IFeatureClassDescription)description;
            IFields requiredFields               = description.RequiredFields;
            IFeatureWorkspaceAnno workspace      = (IFeatureWorkspaceAnno)ifeatureDataset_0.Workspace;
            IGraphicsLayerScale   referenceScale = new GraphicsLayerScale
            {
                ReferenceScale = double_0,
                Units          = esriUnits.esriMeters
            };
            UID instanceCLSID                  = description.InstanceCLSID;
            UID classExtensionCLSID            = description.ClassExtensionCLSID;
            ISymbolCollection symbolCollection = new SymbolCollection();

            symbolCollection.set_Symbol(0, (ISymbol)MakeTextSymbol("宋体", 3.0));
            symbolCollection.set_Symbol(1, (ISymbol)MakeTextSymbol("宋体", 3.5));
            symbolCollection.set_Symbol(2, (ISymbol)MakeTextSymbol("宋体", 3.0));
            symbolCollection.set_Symbol(3, (ISymbol)MakeTextSymbol("宋体", 2.5));
            symbolCollection.set_Symbol(4, (ISymbol)MakeTextSymbol("黑体", 2.0));
            symbolCollection.set_Symbol(5, (ISymbol)MakeTextSymbol("黑体", 1.5));
            symbolCollection.set_Symbol(6, (ISymbol)MakeTextSymbol("宋体", 1.0));
            symbolCollection.set_Symbol(7, (ISymbol)MakeTextSymbol("宋体", 0.4));
            symbolCollection.set_Symbol(8, (ISymbol)MakeTextSymbol("宋体", 0.3));
            symbolCollection.set_Symbol(9, (ISymbol)MakeTextSymbol("黑体", 1.0));
            symbolCollection.set_Symbol(10, (ISymbol)MakeTextSymbol("宋体", 0.5));
            symbolCollection.set_Symbol(11, (ISymbol)MakeTextSymbol("宋体", 0.6));
            symbolCollection.set_Symbol(12, (ISymbol)MakeTextSymbol("宋体", 0.7));
            symbolCollection.set_Symbol(13, (ISymbol)MakeTextSymbol("宋体", 0.8));
            symbolCollection.set_Symbol(14, (ISymbol)MakeTextSymbol("宋体", 0.9));
            symbolCollection.set_Symbol(15, (ISymbol)MakeTextSymbol("宋体", 1.2));
            return(workspace.CreateAnnotationClass(string_0, requiredFields, instanceCLSID, classExtensionCLSID,
                                                   description2.ShapeFieldName, "", ifeatureDataset_0, null, null, referenceScale, symbolCollection, true));
        }
コード例 #3
0
        private IFeatureClass CreateFeatureClass(IFeatureWorkspace FeatureWorkspace, string LayerName, esriFeatureType featureType, esriGeometryType GeometryType)
        {
            IFields     fields = new FieldsClass();
            IFieldsEdit edit   = fields as IFieldsEdit;

            //创建OBJECTID字段
            IField     field3 = new FieldClass();
            IFieldEdit edit2  = field3 as IFieldEdit;

            edit2.Name_2      = "OBJECTID";
            edit2.AliasName_2 = "OBJECTID";
            edit2.Type_2      = esriFieldType.esriFieldTypeOID;
            edit.AddField(field3);

            //创建Shape字段
            IGeometryDef     def   = new GeometryDefClass();
            IGeometryDefEdit edit4 = def as IGeometryDefEdit;

            edit4.GeometryType_2 = GeometryType;
            edit4.GridCount_2    = 1;
            edit4.set_GridSize(0, 1000);
            edit4.AvgNumPoints_2     = 2;
            edit4.HasM_2             = false;
            edit4.HasZ_2             = false;
            edit4.SpatialReference_2 = this.ExportSpatialReference;

            IField     field4 = new FieldClass();
            IFieldEdit edit3  = field4 as IFieldEdit;

            edit3.Name_2        = "SHAPE";
            edit3.AliasName_2   = "SHAPE";
            edit3.Type_2        = esriFieldType.esriFieldTypeGeometry;
            edit3.GeometryDef_2 = def;
            edit.AddField(field4);

            string ShapeFiledName = field4.Name;

            UID uid  = null;
            UID uid2 = null;

            switch (featureType)
            {
            case esriFeatureType.esriFTSimple:       //FeatureClass
                IObjectClassDescription description4 = new FeatureClassDescriptionClass();
                uid  = description4.InstanceCLSID;
                uid2 = description4.ClassExtensionCLSID;
                break;

            case esriFeatureType.esriFTAnnotation:     //AnnotationFeatureClass
                IObjectClassDescription description = new AnnotationFeatureClassDescriptionClass();
                uid          = description.InstanceCLSID;
                uid2         = description.ClassExtensionCLSID;
                GeometryType = esriGeometryType.esriGeometryPolygon;
                break;
            }
            //创建要素对象
            IFeatureClass fc = FeatureWorkspace.CreateFeatureClass(LayerName, fields, uid, uid2, featureType, ShapeFiledName, null);

            return(fc);
        }
コード例 #4
0
ファイル: CmdNewNorthArrow.cs プロジェクト: secondii/Yutai
        private bool method_0()
        {
            IActiveView        activeView        = this._context.ActiveView;
            IGraphicsContainer graphicsContainer = activeView.GraphicsContainer;
            bool result;

            if (graphicsContainer == null)
            {
                return(false);
            }

            try
            {
                frmSymbolSelector frmSymbolSelector = new frmSymbolSelector();
                if (frmSymbolSelector == null)
                {
                    return(false);
                }
                INorthArrow northArrow = new MarkerNorthArrow();
                frmSymbolSelector.SetSymbol(northArrow);
                frmSymbolSelector.SetStyleGallery(this._context.StyleGallery);
                if (frmSymbolSelector.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    northArrow = (frmSymbolSelector.GetSymbol() as INorthArrow);
                    if (northArrow == null)
                    {
                        result = false;
                        return(result);
                    }
                    northArrow.Refresh();
                    IEnvelope envelope = new Envelope() as IEnvelope;
                    envelope.PutCoords(5.0, 10.0, 8.0, 13.0);
                    IEnvelope envelope2 = new Envelope() as IEnvelope;
                    northArrow.QueryBounds(this._context.ActiveView.ScreenDisplay, envelope, envelope2);
                    UID clsid = new UID
                    {
                        Value = "esriCarto.MarkerNorthArrow"
                    };
                    IMapFrame         mapFrame         = graphicsContainer.FindFrame(activeView.FocusMap) as IMapFrame;
                    IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(clsid, northArrow);
                    IElement          element          = mapSurroundFrame as IElement;
                    element.Geometry = envelope2;
                    INewElementOperation operation = new NewElementOperation
                    {
                        ActiveView = this._context.ActiveView,
                        Element    = element
                    };
                    this._context.OperationStack.Do(operation);
                    result = true;
                    return(result);
                }
            }
            catch
            {
            }
            result = false;

            return(result);
        }
コード例 #5
0
ファイル: CmdNewScaleBar.cs プロジェクト: secondii/Yutai
        private bool method_0()
        {
            IActiveView        activeView        = this._context.ActiveView;
            IGraphicsContainer graphicsContainer = activeView.GraphicsContainer;
            bool result;

            if (graphicsContainer == null)
            {
                result = false;
            }
            else
            {
                try
                {
                    frmSymbolSelector frmSymbolSelector = new frmSymbolSelector();
                    if (frmSymbolSelector == null)
                    {
                        result = false;
                        return(result);
                    }
                    IScaleBar scaleBar = new HollowScaleBar();
                    frmSymbolSelector.SetSymbol(scaleBar);
                    frmSymbolSelector.SetStyleGallery(this._context.StyleGallery);
                    if (frmSymbolSelector.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        scaleBar = (frmSymbolSelector.GetSymbol() as IScaleBar);
                        if (scaleBar == null)
                        {
                            result = false;
                            return(result);
                        }
                        UID clsid = new UID
                        {
                            Value = "esriCarto.ScaleBar"
                        };
                        IMapFrame mapFrame = graphicsContainer.FindFrame(activeView.FocusMap) as IMapFrame;
                        scaleBar.Units = mapFrame.Map.DistanceUnits;
                        IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(clsid, scaleBar);
                        IElement          element          = mapSurroundFrame as IElement;
                        IEnvelope         envelope         = new Envelope() as IEnvelope;
                        envelope.PutCoords(2.0, 8.0, 9.0, 10.0);
                        IEnvelope envelope2 = new Envelope() as IEnvelope;
                        scaleBar.QueryBounds(this._context.ActiveView.ScreenDisplay, envelope, envelope2);
                        element.Geometry = envelope2;
                        INewElementOperation newElementOperation = new NewElementOperation();
                        newElementOperation.ActiveView = this._context.ActiveView;
                        newElementOperation.Element    = element;
                        this._context.OperationStack.Do(newElementOperation);
                        result = true;
                        return(result);
                    }
                }
                catch
                {
                }
                result = false;
            }
            return(result);
        }
コード例 #6
0
 public void Deserialize(Deserializer deserializer)
 {
     this.Unknown0 = deserializer.ReadVarint();
     this.Unknown1 = deserializer.ReadUID();
     this.Unknown2 = deserializer.ReadVarint();
     this.Unknown3 = deserializer.ReadVarint();
     this.Unknown4 = deserializer.ReadVarint();
 }
コード例 #7
0
ファイル: Pokemon.cs プロジェクト: pghazanfari/PokemonEngine
 public override bool Equals(object obj)
 {
     if (obj is IPokemon)
     {
         return(UID.Equals((obj as IPokemon).UID));
     }
     return(false);
 }
コード例 #8
0
    public GraphicsLayersListCtrl()
    {
      InitializeComponent();

      //initialize the UID that will be used later to get the graphics layers
      m_uid = new UIDClass();
      m_uid.Value = "{34B2EF81-F4AC-11D1-A245-080009B6F22B}"; //graphics layers category      
    }
コード例 #9
0
        public GraphicsLayersListCtrl()
        {
            InitializeComponent();

            //initialize the UID that will be used later to get the graphics layers
            m_uid       = new UIDClass();
            m_uid.Value = "{34B2EF81-F4AC-11D1-A245-080009B6F22B}"; //graphics layers category
        }
コード例 #10
0
 private char[] CreateUIDCharArray(UID uid)
 {
     //TODO: there has to be a better way...
     char[] fullArray  = new char[8];
     char[] smallArray = uid.ToString().ToCharArray();
     Array.Copy(smallArray, fullArray, smallArray.Length);
     return(fullArray);
 }
コード例 #11
0
        // Token: 0x06000017 RID: 23 RVA: 0x00002A34 File Offset: 0x00000C34
        public static void StaticActivate(Character character, object[] _infos, Effect instance)
        {
            Trainer trainer = new Trainer();

            At.SetValue <UID>(UID.Generate(), typeof(Trainer), trainer, "m_uid");
            At.SetValue <UID>(JuggernautMod.juggernautTreeInstance.UID, typeof(Trainer), trainer, "m_skillTreeUID");
            trainer.StartTraining(character);
        }
コード例 #12
0
        //public BlockShape() : base()
        //{
        //    Init();
        //    m_linkedLayer = new GraphLayer(UID.ToString());
        //    m_linkedLayer.Visible = false;
        //    m_linkedLayer.UseColor = false;

        //    BindingEventHandler();
        //}

        public BlockShape(IGraphSite site) : base(site)
        {
            Init();

            m_linkedLayer = GenerateLayer(UID.ToString().Trim());
            site.Abstract.Insert(m_linkedLayer);
            BindingEventHandler();
        }
コード例 #13
0
 public override int GetHashCode()
 {
     if (UID != null)
     {
         return(UID.GetHashCode());
     }
     return(base.GetHashCode());
 }
コード例 #14
0
        public void AddNewFilter(string id, string msg)
        {
            //元フォームから直接呼ばれる
            ButtonNew.Enabled       = false;
            ButtonEdit.Enabled      = false;
            ButtonRuleUp.Enabled    = false;
            ButtonRuleDown.Enabled  = false;
            ButtonRuleCopy.Enabled  = false;
            ButtonRuleMove.Enabled  = false;
            ButtonDelete.Enabled    = false;
            ButtonClose.Enabled     = false;
            EditFilterGroup.Enabled = true;
            ListTabs.Enabled        = false;
            GroupTab.Enabled        = false;
            ListFilters.Enabled     = false;

            RadioAND.Checked  = true;
            RadioPLUS.Checked = false;
            UID.Text          = id;
            UID.SelectAll();
            MSG1.Text = msg;
            MSG1.SelectAll();
            MSG2.Text = id + msg;
            MSG2.SelectAll();
            TextSource.Text            = "";
            UID.Enabled                = true;
            MSG1.Enabled               = true;
            MSG2.Enabled               = false;
            CheckRegex.Checked         = false;
            CheckURL.Checked           = false;
            CheckCaseSensitive.Checked = false;
            CheckRetweet.Checked       = false;
            CheckLambda.Checked        = false;

            RadioExAnd.Checked  = true;
            RadioExPLUS.Checked = false;
            ExUID.Text          = "";
            ExUID.SelectAll();
            ExMSG1.Text = "";
            ExMSG1.SelectAll();
            ExMSG2.Text = "";
            ExMSG2.SelectAll();
            TextExSource.Text            = "";
            ExUID.Enabled                = true;
            ExMSG1.Enabled               = true;
            ExMSG2.Enabled               = false;
            CheckExRegex.Checked         = false;
            CheckExURL.Checked           = false;
            CheckExCaseSensitive.Checked = false;
            CheckExRetweet.Checked       = false;
            CheckExLambDa.Checked        = false;

            OptCopy.Checked   = true;
            CheckMark.Checked = true;
            UID.Focus();
            _mode      = EDITMODE.AddNew;
            _directAdd = true;
        }
コード例 #15
0
        // 添加图例
        public static void MakeLegend(AxPageLayoutControl pageLayoutControl, IEnvelope envelope)
        {
            IActiveView pActiveView = pageLayoutControl.ActiveView;

            UID pUID = new UID()
            {
                Value = "esriCarto.Legend"
            };
            IGraphicsContainer pGraphicsContainer = pageLayoutControl.PageLayout as IGraphicsContainer;
            IMapFrame          pMapFrame          = pGraphicsContainer.FindFrame(pActiveView.FocusMap) as IMapFrame;
            // 根据唯一标识符,创建与之对应的MapSurroundFrame
            IMapSurroundFrame pMapSurroundFrame = pMapFrame.CreateSurroundFrame(pUID, null);
            // 获取PageLayout中的图例元素
            IElement pDeleteElement = pageLayoutControl.FindElementByName("Legend");

            if (pDeleteElement != null)
            {
                pGraphicsContainer.DeleteElement(pDeleteElement); // 如果已存在图例,删除已经存在的图例
            }
            // 设置MapSurroundFrame背景
            ISymbolBackground pSymbolBackground = new SymbolBackgroundClass()
            {
                FillSymbol = new SimpleFillSymbolClass()
                {
                    Color   = AeUtilsSymbology.GetRgbColor(240, 240, 240),
                    Outline = new SimpleLineSymbolClass()
                    {
                        Color = AeUtilsSymbology.GetRgbColor(0, 0, 0)
                    }
                }
            };

            pMapSurroundFrame.Background = pSymbolBackground;
            // 添加图例
            IElement pElement = pMapSurroundFrame as IElement;

            pElement.Geometry = envelope as IGeometry;
            IMapSurround pMapSurround = pMapSurroundFrame.MapSurround;
            ILegend      pLegend      = pMapSurround as ILegend;

            pLegend.ClearItems();
            pLegend.Title = "图例";
            for (int i = 0; i < pActiveView.FocusMap.LayerCount; i++)
            {
                ILegendItem pLegendItem = new HorizontalLegendItemClass()
                {
                    Layer            = pActiveView.FocusMap.get_Layer(i),
                    ShowDescriptions = false,
                    Columns          = 1,
                    ShowHeading      = true,
                    ShowLabels       = true
                };
                pLegend.AddItem(pLegendItem);
            }
            pGraphicsContainer.AddElement(pElement, 0);
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
コード例 #16
0
 protected EnumeratableDevice(UID uid, DeviceIdentifier deviceIdentifier)
 {
     UID = uid;
     DeviceIdentifier = deviceIdentifier;
     Position = 'a'; //TODO: better default depending on brick/bricklet?
     ConnectedUID = new UID(0);
     HardwareVersion = new Version(1, 0, 0);
     FirmwareVersion = new Version(1, 0, 0);
 }
コード例 #17
0
        private IFeatureClass method_1(IFeatureWorkspace ifeatureWorkspace_0, string string_4, double double_0,
                                       ITextSymbol itextSymbol_0, IFields ifields_0)
        {
            IObjectClassDescription  description  = new AnnotationFeatureClassDescriptionClass();
            IFeatureClassDescription description2 = description as IFeatureClassDescription;
            IClone     requiredFields             = description.RequiredFields as IClone;
            IFields    fields = requiredFields.Clone() as IFields;
            IFieldEdit edit   = null;
            int        index  = fields.FindField(description2.ShapeFieldName);

            edit = fields.get_Field(index) as IFieldEdit;
            IGeometryDefEdit      geometryDef    = edit.GeometryDef as IGeometryDefEdit;
            IFeatureWorkspaceAnno anno           = ifeatureWorkspace_0 as IFeatureWorkspaceAnno;
            IGraphicsLayerScale   referenceScale = new GraphicsLayerScaleClass
            {
                ReferenceScale = double_0,
                Units          = esriUnits.esriMeters
            };
            UID instanceCLSID                  = description.InstanceCLSID;
            UID classExtensionCLSID            = description.ClassExtensionCLSID;
            ISymbolCollection symbolCollection = new SymbolCollectionClass();

            symbolCollection.set_Symbol(0, itextSymbol_0 as ISymbol);
            IAnnotateLayerPropertiesCollection2 annoProperties = new AnnotateLayerPropertiesCollectionClass();
            IAnnotateLayerProperties            item           = new LabelEngineLayerPropertiesClass
            {
                Class         = "要素类 1",
                FeatureLinked = false,
                AddUnplacedToGraphicsContainer = false,
                CreateUnplacedElements         = true,
                DisplayAnnotation = true,
                UseOutput         = true
            };
            ILabelEngineLayerProperties properties2 = item as ILabelEngineLayerProperties;

            properties2.Offset   = 0.0;
            properties2.SymbolID = 0;
            properties2.Symbol   = itextSymbol_0;
            annoProperties.Add(item);
            for (int i = 0; i < ifields_0.FieldCount; i++)
            {
                if (fields.FindField(ifields_0.get_Field(i).Name) == -1)
                {
                    (fields as IFieldsEdit).AddField(ifields_0.get_Field(i));
                }
            }
            try
            {
                return(anno.CreateAnnotationClass(string_4, fields, instanceCLSID, classExtensionCLSID,
                                                  description2.ShapeFieldName, "", null, null, annoProperties, referenceScale, symbolCollection, false));
            }
            catch (Exception exception)
            {
                Logger.Current.Error("", exception, "");
            }
            return(null);
        }
コード例 #18
0
        public RandomAmbientLightBricklet(UID uid)
            : base(uid, DeviceIdentifier.BrickletAmbientLight)
        {
            AnalogValue = new ValueDecorator<UInt16>(UID, 2, 5, 6, 14);
            Illuminance = new ValueDecorator<UInt16>(UID, 1, 3, 4, 13, AnalogValue);
            Decorators = Illuminance;

            Illuminance.CurrentValue = 5000;
        }
コード例 #19
0
        UID myUID; // UID for the DMCII Raster Type.
        #endregion

        #region IRasterTypeFactory Members

        public DMCIIRasterTypeFactory()
        {
            string rasterTypeName = "DMCII Raster Type";
            myRasterTypeNames = new StrArrayClass();
            myRasterTypeNames.Add(rasterTypeName);

            myUID = new UIDClass();
            myUID.Value = "{5DEF8E3C-51E9-49af-A3BE-EF8C68A4BBBE}";
        }
コード例 #20
0
 protected override void OnClick()
 {
     UID uid = new UID();
     uid.Value = ThisAddIn.IDs._DocWindowSami; // ThisAddin.IDs returns all the class IDs under this Add-in project
     IDockableWindowManager dockWindowManager = ArcMap.Application as IDockableWindowManager;
     IDockableWindow dockableWindow = dockWindowManager.GetDockableWindow(uid);
     //IDockableWindow dockableWindow = GetDockableWindow(ArcMap.Application, "esriGeoprocessingUI.GPCommandWindow"); // Open a System dockable window
     dockableWindow.Show(true); // use False to hide the dockable window
 }
コード例 #21
0
        public RandomAmbientLightBricklet(UID uid)
            : base(uid, DeviceIdentifier.BrickletAmbientLight)
        {
            AnalogValue = new ValueDecorator <UInt16>(UID, 2, 5, 6, 14);
            Illuminance = new ValueDecorator <UInt16>(UID, 1, 3, 4, 13, AnalogValue);
            Decorators  = Illuminance;

            Illuminance.CurrentValue = 5000;
        }
コード例 #22
0
ファイル: CommandBarExtensions.cs プロジェクト: wey12138/Wave
        /// <summary>
        ///     Adds the command to the <paramref name="toolbarUid" />
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="toolbarUid">The toolbar uid.</param>
        /// <param name="commandUid">The command uid.</param>
        public static void Add(this ICommandBars source, UID toolbarUid, UID commandUid)
        {
            ICommandBar toolbar = source.Find(toolbarUid) as ICommandBar;

            if (toolbar != null)
            {
                toolbar.Add(commandUid);
            }
        }
コード例 #23
0
        public static IEditor FindEditor()
        {
            var app       = FindAppObject();
            UID editorUID = new UID {
                Value = "esriEditor.Editor"
            };

            return(app.FindExtensionByCLSID(editorUID) as IEditor);
        }
コード例 #24
0
 public ValueDecorator(UID uid, byte getValue, byte setCBPeriod, byte getCBPeriod, byte valueCB, Device decoratedDevice = null)
 {
     UID = uid;
     FunctionGetValue = getValue;
     FunctionSetValueCallbackPeriod = setCBPeriod;
     FunctionGetValueCallbackPeriod = getCBPeriod;
     FunctionValueCallback          = valueCB;
     DecoratedDevice = decoratedDevice;
 }
コード例 #25
0
 public ModdedAbilityHijack(Ability.AbilityData _data, UID _owner) : base(_data, _owner)
 {
     ModdedAbilityHijack.AbilityData abilityData = (ModdedAbilityHijack.AbilityData)_data;
     this.m_HijackedAbilityIDs = abilityData.m_HijackedAbilityIDs;
     this.m_AIEntity.m_Modifiers.RegisterEventCallback(ModifierType.EnergyRegenRate, new Modifiers.OnModifierChangedDelegate(this.OnModifierChanged));
     this.m_AIEntity.m_Modifiers.RegisterEventCallback(ModifierType.EnergyRegenRateMultiplier, new Modifiers.OnModifierChangedDelegate(this.OnModifierChanged));
     this.m_AIEntity.m_Modifiers.RegisterEventCallback(ModifierType.JammerAmount, new Modifiers.OnModifierChangedDelegate(this.OnModifierChanged));
     this.m_AIEntity.RegisterEventCallback(AIEventNotification.Killed, new AIEntityEvent(this.NotifyMyDeath));
 }
コード例 #26
0
ファイル: CommandBarExtensions.cs プロジェクト: wey12138/Wave
        /// <summary>
        ///     Replaces the <paramref name="oldCommandUid" /> on the toolbar with the <paramref name="newCommandUid" />
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="toolbarUid">The toolbar uid.</param>
        /// <param name="newCommandUid">The new command uid.</param>
        /// <param name="oldCommandUid">The old command uid.</param>
        public static void Replace(this ICommandBars source, UID toolbarUid, UID newCommandUid, UID oldCommandUid)
        {
            ICommandBar toolbar = source.Find(toolbarUid) as ICommandBar;

            if (toolbar != null)
            {
                toolbar.Replace(newCommandUid, oldCommandUid);
            }
        }
コード例 #27
0
ファイル: NotifyIcon.cs プロジェクト: cairoshell/ManagedShell
        /// <summary>
        /// Checks the equality of the icon based on the hWnd and uID;
        /// </summary>
        /// <param name="other">The other NotifyIcon to compare to.</param>
        /// <returns>Indication of equality.</returns>
        public bool Equals(NotifyIcon other)
        {
            if (other == null)
            {
                return(false);
            }

            return((HWnd.Equals(other.HWnd) && UID.Equals(other.UID)) || (other.GUID != Guid.Empty && GUID.Equals(other.GUID)));
        }
コード例 #28
0
 public void DestroyEntity(ref UID entity)
 {
     if (this.SuppressDestroyEntity == 0)
     {
         var id = entity;
         this.Vanilla.DestroyEntity(ref entity);
         this.OnEntityDestroyed?.Invoke(id);
     }
 }
コード例 #29
0
        public override bool Equals(object obj)
        {
            if (obj is Unique.IPokemon)
            {
                UID.Equals((obj as Unique.IPokemon).UID);
            }

            return(false);
        }
コード例 #30
0
        public void NoDuplicates()
        {
            var values = new HashSet <string>();

            for (var i = 0; i < 5000000; i++)
            {
                values.Add(UID.Generate(i));
            }
        }
コード例 #31
0
 protected EnumeratableDevice(UID uid, DeviceIdentifier deviceIdentifier)
 {
     UID = uid;
     DeviceIdentifier = deviceIdentifier;
     Position         = 'a'; //TODO: better default depending on brick/bricklet?
     ConnectedUID     = new UID(0);
     HardwareVersion  = new Version(1, 0, 0);
     FirmwareVersion  = new Version(1, 0, 0);
 }
コード例 #32
0
ファイル: Auth.cs プロジェクト: nastys/PD_Tool
        public void BINReader(string file)
        {
            Dictionary <string, object> Dict = new Dictionary <string, object>();

            string[] dataArray;

            IO = File.OpenReader(file + ".bin");

            IO.Format = Main.Format.F;
            Signature = IO.ReadInt32();
            if (Signature != 0x44334123)
            {
                return;
            }
            Signature = IO.ReadInt32();
            if (Signature != 0x5F5F5F41)
            {
                return;
            }
            IO.ReadInt64();

            string[] STRData = IO.ReadString(IO.Length - IO.Position).Replace("\r", "").Split('\n');
            for (int i = 0; i < STRData.Length; i++)
            {
                dataArray = STRData[i].Split('=');
                if (dataArray.Length == 2)
                {
                    Dict.GetDictionary(dataArray[0], dataArray[1]);
                }
            }

            if (Dict.FindValue(out string value, "category.length"))
            {
                Category = new string[int.Parse(value)];
                for (int i0 = 0; i0 < Category.Length; i0++)
                {
                    if (Dict.FindValue(out value, "category." + i0 + ".value"))
                    {
                        Category[i0] = value;
                    }
                }
            }

            if (Dict.FindValue(out value, "uid.length"))
            {
                _UID = new UID[int.Parse(value)];
                for (int i0 = 0; i0 < _UID.Length; i0++)
                {
                    Dict.FindValue(out _UID[i0].Category, "uid." + i0 + ".category");
                    Dict.FindValue(out _UID[i0].OrgUid, "uid." + i0 + ".org_uid");
                    Dict.FindValue(out _UID[i0].Size, "uid." + i0 + ".size");
                    Dict.FindValue(out _UID[i0].Value, "uid." + i0 + ".value");
                }
            }

            IO.Close();
        }
コード例 #33
0
 public void Read(BinaryReader reader)
 {
     uid   = UID.ReadNew(reader);
     cells = new Cell[reader.ReadUInt32()];
     for (int i = 0; i < cells.Length; i++)
     {
         cells[i] = Cell.ReadNew(reader);
     }
 }
コード例 #34
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Parameters != null)
         {
             hashCode = hashCode * 59 + Parameters.GetHashCode();
         }
         if (ParameterGroups != null)
         {
             hashCode = hashCode * 59 + ParameterGroups.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Label != null)
         {
             hashCode = hashCode * 59 + Label.GetHashCode();
         }
         if (Category != null)
         {
             hashCode = hashCode * 59 + Category.GetHashCode();
         }
         if (ItemType != null)
         {
             hashCode = hashCode * 59 + ItemType.GetHashCode();
         }
         if (Kind != null)
         {
             hashCode = hashCode * 59 + Kind.GetHashCode();
         }
         if (StateDescription != null)
         {
             hashCode = hashCode * 59 + StateDescription.GetHashCode();
         }
         if (Tags != null)
         {
             hashCode = hashCode * 59 + Tags.GetHashCode();
         }
         if (UID != null)
         {
             hashCode = hashCode * 59 + UID.GetHashCode();
         }
         if (Advanced != null)
         {
             hashCode = hashCode * 59 + Advanced.GetHashCode();
         }
         if (CommandDescription != null)
         {
             hashCode = hashCode * 59 + CommandDescription.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #35
0
        public static void classifyRender(IRasterLayer rastlayer, string classMethod, int count, IColorRamp ramp)
        {
            try
            {
                IRasterBand band = GetBand(rastlayer);
                if (band.Histogram == null)
                {
                    band.ComputeStatsAndHist();
                }
                IRasterClassifyColorRampRenderer rasClassifyRender = new RasterClassifyColorRampRendererClass();
                IRasterRenderer rasRender = rasClassifyRender as IRasterRenderer;
                rasRender.Raster = rastlayer.Raster;
                rasRender.Update();

                int       numClasses = count;
                IClassify classify   = null;

                switch (classMethod)
                {
                case "等间距分级":
                    classify = new EqualIntervalClass();
                    break;

                case "自然断点分级":
                    classify = new NaturalBreaksClass();
                    break;
                }
                classify.Classify(ref numClasses);

                double[] Classes = classify.ClassBreaks as double[];
                UID      pUid    = classify.ClassID;
                IRasterClassifyUIProperties rasClassifyUI = rasClassifyRender as IRasterClassifyUIProperties;
                rasClassifyUI.ClassificationMethod = pUid;
                rasClassifyRender.ClassField       = "Value";
                rasClassifyRender.ClassCount       = count;
                rasRender.Update();
                IColor            pColor;
                ISimpleFillSymbol pSym;

                for (int j = 0; j < count; j++)
                {
                    pColor     = ramp.get_Color(j * (ramp.Size - 1) / (count - 1));
                    pSym       = new SimpleFillSymbolClass();
                    pSym.Color = pColor;
                    rasClassifyRender.set_Symbol(j, (ISymbol)pSym);
                    rasClassifyRender.set_Break(j, rasClassifyRender.get_Break(j));
                }
                rasRender.Update();

                rastlayer.Renderer = rasClassifyRender as IRasterRenderer;
            }
            catch
            {
                XtraMessageBox.Show("唯一值数量已达到限制(65536)");
            }
        }
コード例 #36
0
    // PUBLIC ACCESSORS

    public float GetFactor(UID id)
    {
        float f;

        if (factors.TryGetValue(id.Value, out f))
        {
            return(f);
        }
        return(1);
    }
コード例 #37
0
        public RandomBarometerBricklet(UID uid)
            : base(uid, DeviceIdentifier.BrickletBarometer)
        {
            AirPressure = new ValueDecorator<Int32>(UID, 1, 3, 4, 15);
            Altitude = new ValueDecorator<Int32>(UID, 2, 5, 6, 16, AirPressure);
            Temperature = new ValueDecorator<Int16>(UID, 14, Altitude);
            Decorators = Temperature;

            AirPressure.CurrentValue = 200000;
            CalculateAltitude();
            Temperature.CurrentValue = 2300;
        }
コード例 #38
0
        UID myUID; // UID for the Thumbnail Raster type.
        #endregion

        #region IRasterTypeFactory Members

        public ThumbnailFactory()
        {
            // The Raster Type name should follow the pattern 
            // 'Thumbnail ' follwed by the name of the built-in 
            // Raster Type to attach the Thumbnail Builder to.            
            myRasterTypeNames = new StrArrayClass();
            myRasterTypeNames.Add("Thumbnail Raster Dataset");
            myRasterTypeNames.Add("Thumbnail QuickBird");

            myUID = new UIDClass();
            myUID.Value = "{C6629CC4-B301-451a-9481-4D7751E9701C}";
        }
コード例 #39
0
        protected override void OnClick()
        {
            //
            //  TODO: Sample code showing how to access button host
            //

            UID id = new UID();
            id.Value = "esriEditor.Editor";

            IApplication application = ArcMap.Application;
            IEditor editor = application.FindExtensionByCLSID(id) as IEditor;
            if (editor.EditState != esriEditState.esriStateEditing)
            {
                MessageBox.Show("MUST BE IN EDIT SESSION");
                return;
            }
            editor.StartOperation();
            for (int i = 0; i < ArcMap.Document.ActiveView.FocusMap.LayerCount; i++)
            {
                if (ArcMap.Document.ActiveView.FocusMap.Layer[i] is IFeatureLayer)
                {
                    IFeatureLayer layer = (IFeatureLayer)ArcMap.Document.ActiveView.FocusMap.Layer[i];
                    IFeatureSelection featureSelection = layer as IFeatureSelection;
                    if (featureSelection.SelectionSet.Count > 0)
                    {
                        ISelectionSet selectionSet = featureSelection.SelectionSet as ISelectionSet2;
                        IFeature feature;
                        IEnumFeature features = editor.EditSelection;
                        while ((feature = features.Next()) != null)
                        {
                            IPoint point = new Point
                            {
                                X = (((feature.Shape.Envelope.XMax + feature.Shape.Envelope.XMin)/2.0)),
                                Y = (((feature.Shape.Envelope.YMax + feature.Shape.Envelope.YMin)/2.0)),
                                SpatialReference = feature.Shape.SpatialReference
                            };
                            Double radians = .5*Math.PI;
                            IGeometry geometry = feature.ShapeCopy;
                            ((ITransform2D)geometry).Rotate(point ,radians);
                            feature.Shape = geometry;
                            feature.Store();
                        }
                    }
                }
            }
            editor.StopOperation("DONE");
            ArcMap.Document.ActiveView.Refresh();
            ArcMap.Application.CurrentTool = null;
        }
        IRasterFunctionVariable myBandIndicesVar; // Variable for the Band Indices property.
        #endregion

        public NDVICustomFunctionUIClass()
        {
            myForm = new NDVICustomFunctionUIForm();
            myArgs = null;
            myPriority = 100;
            myPageSite = null;
            myHelpFile = "";
            mySupportedID = new UIDClass();
            // The UID of the NDVICustomFunction object.
            mySupportedID.Value = "{" + "652642F3-9106-4EB3-9262-A4C39E03BC56" + "}";
            templateMode = false;

            myRasterVar = null;
            myBandIndicesVar = null;
        }
コード例 #41
0
        public NDVICustomFunction()
        {
            myName = "NDVI Custom Function";
            myPixeltype = rstPixelType.PT_FLOAT;
            myDescription = "Custom NDVI Function which calculates the NDVI without any scaling.";
            myValidFlag = true;
            myFunctionHelper = new RasterFunctionHelper();

            myInpPixeltype = myPixeltype;
            myInpNumBands = 0;

            myBandIndices = null;

            myUID = new UID();
            myUID.Value = "{652642F3-9106-4EB3-9262-A4C39E03BC56}";
        }
コード例 #42
0
 private ICommandBar GetMainBar()
 {
     try
     {
         IApplication papp = ArcMap.Application;
         UID uid = new UID();
         uid.Value = c_mainMenuID;
         MxDocument mx = papp.Document as MxDocument;
         ICommandBars cmdBars = mx.CommandBars;
         ICommandItem cmd = cmdBars.Find(uid, false, false);
         return cmd as ICommandBar;
     }
     catch (Exception ex)
     {
         return null;
     }
 }
コード例 #43
0
        IRasterFunctionVariable myWatermarkImagePathVar; // Variable for WatermarkImagePath property.
        #endregion

        public WatermarkFunctionUIClass()
        {
            myForm = new WatermarkFunctionUIForm();
            myArgs = null;
            myPriority = 100;
            myPageSite = null;
            myHelpFile = "";
            mySupportedID = new UIDClass();
            mySupportedID.Value = "{" + "168721E7-7010-4a36-B886-F644437B164D" + "}";
            templateMode = false;
            isFormReadOnly = false;

            myRasterVar = null;
            myBlendPercentageVar = null;
            myWatermarkLocationVar = null;
            myWatermarkImagePathVar = null;
        }
コード例 #44
0
        bool templateMode; // Flag to specify template mode.

        #endregion Fields

        #region Constructors

        public WatermarkFunctionUIClass()
        {
            myForm = new WatermarkFunctionUIForm();
            myArgs = null;
            myPriority = 100;
            myPageSite = null;
            myHelpFile = "";
            mySupportedID = new UIDClass();
            mySupportedID.Value = "{" + "25BE29A6-AAF9-496E-AE73-130D5947682D" + "}";
            templateMode = false;
            isFormReadOnly = false;

            myRasterVar = null;
            myBlendPercentageVar = null;
            myWatermarkImagePathVar = null;
            myXGapVar = null;
            myYGapVar = null;
        }
コード例 #45
0
        private void AddMenu()
        {
            ICommandBar mainMenuBar = GetMainBar();
            if (mainMenuBar == null)
            {
                return;
            }

            string menuID = "BathymetryTools";
            ICommandItem cmdItem = mainMenuBar.Find(menuID, false);

            if (cmdItem != null)
            {
                return;
            }

            UID uid = new UID();
            uid.Value = menuID;
            Object index = mainMenuBar.Count - 1;
            ICommandBar menuBathymetry = mainMenuBar.Add(uid, index) as ICommandBar;
            ICommandItem main = mainMenuBar as ICommandItem;
            main.Refresh();
        }
コード例 #46
0
        // Overrides
        protected override void OnStartup()
        {
            s_extension = this;

            // Wire up events
            ArcMap.Events.NewDocument += ArcMap_NewOpenDocument;
            ArcMap.Events.OpenDocument += ArcMap_NewOpenDocument;

            //Listen for a Stop Edits Events to be fired
            //get the editor
            UID editorUid = new UID();
            editorUid.Value = "esriEditor.Editor";
            m_editor = ArcMap.Application.FindExtensionByCLSID(editorUid) as IEditor3;
            m_editEvents = m_editor as IEditEvents_Event;

            EnableEditListeners();
            _users = new List<iFormBuilderAPI.User>();
            Initialize();
        }
コード例 #47
0
ファイル: LayerControl.cs プロジェクト: chinasio/minegis
        //把所有图层设为可见
        public static void layVisble(AxMapControl myMapControl)
        {
            IEnumLayer pEnumLayers;
                UID pUID = new UID();
                pUID.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";

                pEnumLayers = myMapControl.Map.get_Layers(pUID, true);
                pEnumLayers.Reset();
                ILayer pLayer;
                pLayer = (ILayer)pEnumLayers.Next();
                while (pLayer != null)
                {
                    if (pLayer is IFeatureLayer)
                    {
                        IFeatureLayer nFeatureLayer = (IFeatureLayer)pLayer;
                        nFeatureLayer.Visible = true;
                        nFeatureLayer.Selectable = true;
                    }
                    if (pLayer is IRasterLayer)
                    {
                        IRasterLayer pRasterLayer = (IRasterLayer)pLayer;
                        pRasterLayer.Visible = true;

                    }
                    pLayer = pEnumLayers.Next();

                }

            if (CurdisplayViewType != displayViewType.layViewVisble)
            {
                CurdisplayViewType = displayViewType.layViewVisble;
            }
            //m_activeView.Refresh();
        }
コード例 #48
0
 public RandomTemperatureBricklet(UID uid)
     : base(uid, DeviceIdentifier.BrickletTemperature)
 {
     Temperature = new ValueDecorator<Int16>(UID, 1, 2, 3, 8);
     Temperature.CurrentValue = 2300;
 }
コード例 #49
0
        private bool EnablePublisherExtension()
        {

            bool checkedOutOK = false;

            try
            {
                IExtensionManager extMgr = new ExtensionManagerClass();

                IExtensionManagerAdmin extAdmin = (IExtensionManagerAdmin)extMgr;

                UID uid = new UID();
                uid.Value = "esriPublisherUI.Publisher";
                object obj = 0;
                extAdmin.AddExtension(uid, ref obj);

                IExtensionConfig extConfig = (IExtensionConfig)extMgr.FindExtension(uid);

                if ((!(extConfig.State == esriExtensionState.esriESUnavailable)))
                {
                    //This checks on the extension
                    extConfig.State = esriExtensionState.esriESEnabled;
                    checkedOutOK = true;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Publisher extension has failed to check out.", "Error");
            }

            return checkedOutOK;
        } 
コード例 #50
0
    public override void OnCreate(object hook)
    {
      if (hook == null)
        return;

      m_application = hook as IApplication;

      //get the editor
      UID editorUid = new UID();
      editorUid.Value = "esriEditor.Editor";
      m_editor = m_application.FindExtensionByCLSID(editorUid) as IEditor3;
    }
コード例 #51
0
ファイル: AddVectorTool.cs プロジェクト: 609878415/fff12138
        /// <summary>
        /// Occurs when this tool is created
        /// </summary>
        /// <param name="hook">Instance of the application</param>
        public override void OnCreate(object hook)
        {
            m_application = hook as IApplication;

            //get the editor
            UID editorUid = new UID();
            editorUid.Value = "esriEditor.Editor";
            m_editor = m_application.FindExtensionByCLSID(editorUid) as IEditor3;
            m_editEvents = m_editor as IEditEvents_Event;
            m_editEvents5 = m_editor as IEditEvents5_Event;
        }
コード例 #52
0
 /// <summary>
 /// Add a command item to the command bar by an Unique Identifier Object (UID).
 /// </summary>
 private void AddItem(UID itemUID)
 {
     m_toolbarMenu.AddItem(itemUID.Value, itemUID.SubType, -1, m_beginGroupFlag, esriCommandStyles.esriCommandStyleIconAndText);
     m_beginGroupFlag = false; //Reset group flag
 }
コード例 #53
0
        public static void AddBarrier(IPoint pPnt, IApplication app, double snapTol)
        {
            IProgressDialogFactory pProDFact = null;
            IStepProgressor pStepPro = null;
            IProgressDialog2 pProDlg = null;
            ITrackCancel pTrkCan = null;

            List<IGeometricNetwork> gnList = null;
            IGeometricNetwork gn = null;
            IPoint snappedPoint = null;
            IFlagDisplay pFlagDisplay = null;
            INetFlag startNetFlag = null;
            INetworkAnalysisExt pNetAnalysisExt = null;
            UID pID = null;
            IMap pMap = null;
            int EID = -1;
            double distanceAlong;

            try
            {

                pMap = (app.Document as IMxDocument).FocusMap;
                bool boolCont = true;
                // Create a CancelTracker
                pTrkCan = new CancelTrackerClass();
                // Create the ProgressDialog. This automatically displays the dialog
                pProDFact = new ProgressDialogFactoryClass();
                pProDlg = (IProgressDialog2)pProDFact.Create(pTrkCan, 0);

                // Set the properties of the ProgressDialog
                pProDlg.CancelEnabled = true;

                pProDlg.Animation = esriProgressAnimationTypes.esriProgressGlobe;

                // Set the properties of the Step Progressor
                pStepPro = (IStepProgressor)pProDlg;

                pStepPro.MinRange = 0;
                pStepPro.MaxRange = 6;
                pStepPro.StepValue = 1;
                pStepPro.Position = 0;
                pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_4");

                gnList = Globals.GetGeometricNetworksCurrentlyVisible(ref pMap);
                int gnIdx = -1;

                if (gnList == null || gnList.Count == 0)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_2"), A4LGSharedFunctions.Localizer.GetString("GeoNetToolsErrorLbl_2"));
                    return;
                }

                // Create junction or edge flag at start of trace - also returns geometric network, snapped point, and EID of junction
                pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_6");
                pStepPro.Step();
                boolCont = pTrkCan.Continue();

                if (!boolCont)
                {

                    pStepPro.Hide();
                    pProDlg.HideDialog();
                    pStepPro = null;
                    pProDlg = null;
                    pProDFact = null;
                    return;
                }

                startNetFlag = Globals.GetJunctionFlag(ref pPnt, ref  pMap, ref gnList, snapTol, ref gnIdx, out snappedPoint, out EID, out  pFlagDisplay, false) as INetFlag;
                if (startNetFlag == null)
                {
                    startNetFlag = Globals.GetEdgeFlag(ref pPnt, ref pMap, ref gnList, snapTol, ref gnIdx, out snappedPoint, out EID, out distanceAlong, out  pFlagDisplay, false) as INetFlag;
                }

                //Set network to trace
                if (gnIdx > -1)
                    gn = gnList[gnIdx] as IGeometricNetwork;

                // Stop if user point was not on a visible network feature, old trace results and selection are cleared
                if (gn == null || startNetFlag == null)
                {
                    return;
                }

                if (app != null)
                {
                    pID = new UID();

                    pID.Value = "esriEditorExt.UtilityNetworkAnalysisExt";
                    pNetAnalysisExt = (INetworkAnalysisExt)app.FindExtensionByCLSID(pID);
                    Globals.SetCurrentNetwork(ref pNetAnalysisExt, ref gn);
                    Globals.AddBarrierToGN(pNetAnalysisExt, gn, pFlagDisplay);
                    //  pFlagDisplay
                    pNetAnalysisExt = null;
                    pID = null;

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsLbl_3") + ": " + ex.ToString());

            }
            finally
            {
                if (pProDlg != null)
                {

                    pProDlg.HideDialog();
                }
                pStepPro = null;
                pProDlg = null;
                pProDFact = null;

                pTrkCan = null;
                pMap = null;
                gnList = null;
                gn = null;
                snappedPoint = null;
                pFlagDisplay = null;
                startNetFlag = null;
                pNetAnalysisExt = null;
                pID = null;
                pMap = null;
            }
        }
コード例 #54
0
        private static bool CreateLateralFromMainPoint(ref IApplication app, ref  IEditor editor, IFeature pointFeature,
                                                     IFeatureLayer mainLineFLayer, IFeatureLayer targetLineFLayer, IEditTemplate targetLineEditTemplate,
                                                     List<pointAlongSettings> pointAlongLayers, bool startAtMain, FromToField[] fromToPairs, LateralLine_AngleDetails latDet, bool SearchOnLayer, bool CheckSelection)
        {
            List<IFeature> pointsAlong = new List<IFeature>();

            //IGeometry pGeometry;
            IPolyline polyline;

            //IPoint pToPoint;
            //IPoint pFromPoint;
            //IConstructPoint pConstructPoint;

            UID pId = new UID();

            IFeature pFeat;
            // double pi;
            double dblDegrees;
            double dblAngleRad;
            double dblLateralLength;

            //Find LineAngle field in the layer
            //iLayerLineAngleFieldPos = pFC.FindField(c_sLineAngleFieldName)
            //If iLayerLineAngleFieldPos < 0 Then
            //  MsgBox c_sLineAngleFieldName & " was not found in the highlighted layer.", vbCritical, c_sTitle
            //  Exit Sub
            //End If

            if (targetLineFLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolyline)
            { //MsgBox "Edit target must be a polyline layer (i.e. laterals).", vbCritical, c_sTitle
                return false;
            }

            dblDegrees = 90;
            if (!Globals.IsNumeric(latDet.AngleField))
            {
                int fldIdx = Globals.GetFieldIndex(pointFeature.Class.Fields, latDet.AngleField);

                if (fldIdx > -1)
                {

                    string temp = pointFeature.get_Value(fldIdx).ToString();
                    if (Globals.IsNumeric(temp))
                    {
                        Double.TryParse(temp, out dblDegrees);
                    }
                }

            }
            else
            {
                Double.TryParse(latDet.AngleField, out dblDegrees);
            }

            dblLateralLength = 10;
            if (!Globals.IsNumeric(latDet.LengthField))
            {
                int fldIdx = Globals.GetFieldIndex(pointFeature.Class.Fields, latDet.LengthField);

                if (fldIdx > -1)
                {

                    string temp = pointFeature.get_Value(fldIdx).ToString();
                    if (Globals.IsNumeric(temp))
                    {
                        Double.TryParse(temp, out dblLateralLength);
                    }
                }

            }
            else
            {
                Double.TryParse(latDet.LengthField, out dblLateralLength);
            }

            if (latDet.AngleType.ToUpper() == "CLOCK")
            {
                dblAngleRad = Globals.ConvertDegToRads(Globals.ConvertClockPositionToDegrees(dblDegrees));
            }
            else if (latDet.AngleType.ToUpper() == "RADIANS")
                dblAngleRad = Globals.ConvertDegToRads(dblDegrees);
            else
                dblAngleRad = dblDegrees;

            string dirVal = latDet.DirectionField;
            if (dirVal != "")
            {
                int fldIdx = Globals.GetFieldIndex(pointFeature.Class.Fields, dirVal);

                if (fldIdx > -1)
                {

                    dirVal = pointFeature.get_Value(fldIdx).ToString();

                }

            }
            else
            {
                dirVal = "";
            }

            if (dirVal.ToUpper() == latDet.LookingUpstreamValue.ToUpper())
            {
                dblAngleRad = Globals.ConvertDegToRads(Globals.ConvertRadsToDegrees(dblAngleRad) + 180);
            }
            else if (dirVal == latDet.LookingDownstreamValue)
            {

            }
            else
            {

            }

            if (latDet.OnlyPerp.ToUpper() == "TRUE")
            {
                double val = Globals.ConvertRadsToDegrees(dblAngleRad);
                if (val >= 0.0 && val <= 180.0)
                {
                    dblAngleRad = Globals.ConvertDegToRads(90);
                }
                else
                {
                    dblAngleRad = Globals.ConvertDegToRads(270);

                }
            }
            polyline = Globals.CreateAngledLineFromLocationOnLine((IPoint)pointFeature.Shape, mainLineFLayer, SearchOnLayer, dblAngleRad, dblLateralLength, latDet.AddAngleToLineAngle, startAtMain, CheckSelection);
            //Add that line to Laterals lateral
            if (targetLineEditTemplate != null)
            {
                pFeat = Globals.CreateFeature(polyline as IGeometry, targetLineEditTemplate, editor, app, false, false, true);
            }
            else
            {
                pFeat = Globals.CreateFeature(polyline as IGeometry, targetLineFLayer, editor, app, false, false, true);
            }
            pFeat.Store();
            if (pointAlongLayers != null)
            {
                foreach (pointAlongSettings pPointAlongLayer in pointAlongLayers)
                {
                    if (pPointAlongLayer.PolygonIntersectLayer != null)
                        pointsAlong.Add(Globals.AddPointAlongLineWithIntersect(ref app, ref editor, polyline as ICurve, pPointAlongLayer.PointAlongLayer, pPointAlongLayer.PointAlongDistance, pPointAlongLayer.DistanceIsPercent, pPointAlongLayer.PointAlongEditTemplate, pPointAlongLayer.PolygonIntersectLayer, pPointAlongLayer.PolygonIntersectSide));

                    else
                        pointsAlong.Add(Globals.AddPointAlongLine(ref app, ref editor, polyline as ICurve, pPointAlongLayer.PointAlongLayer, pPointAlongLayer.PointAlongDistance, pPointAlongLayer.DistanceIsPercent, pPointAlongLayer.PointAlongEditTemplate));

                    //   idx++;
                }
            }

            if (pFeat is INetworkFeature)
            {
                INetworkFeature pNF = (INetworkFeature)pFeat;
                pNF.CreateNetworkElements();
                //pNF.Connect();

            }

            return true;
        }
コード例 #55
0
 private ICommandBar GetMainBar()
 {
   try
   {
     //Grab the root menu bar
     UID uid = new UID();
     uid.Value = c_mainMenuID;
     MxDocument mx = (MxDocument)m_application.Document;
     ICommandBars cmdBars = mx.CommandBars;
     ICommandItem x = cmdBars.Find(uid, false, false);
     return cmdBars.Find(uid, false, false) as ICommandBar;
   }
   catch
   {
     return null;
   }
 }
コード例 #56
0
    private void UnLoadCustomizations()
    {
      ICommandBar topMenuBar = GetMainBar();

      if (topMenuBar == null)
        return;

      // Remove AcmeMenu
      UID uid = new UID();
      uid.Value = c_menuID;
      ICommandBar myMenu = topMenuBar.Find(uid, false) as ICommandBar;
      ICommandItem myMenuItem = myMenu as ICommandItem;

      myMenuItem.Delete();

      ((ICommandItem)topMenuBar).Refresh();

      m_isMenuPresent = false;
    }
コード例 #57
0
        private void showCommandBar(UID commandbarID)
        {
            try
            {
                ICommandBars commandBars = ArcCatalog.Document.CommandBars;

                ICommandItem commandItem = commandBars.Find(commandbarID, false, false);
                if (commandItem != null && commandItem.Type == esriCommandTypes.esriCmdTypeToolbar)
                {
                    ICommandBar cb = (ICommandBar)commandItem;
                    cb.Dock(esriDockFlags.esriDockShow);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to show commandbar: " + commandbarID + Environment.NewLine + ex.Message);
            }
        }
コード例 #58
0
        public void Startup(ref object initializationData)
        {
            try
            {
                m_application = initializationData as IApplication;
                if (m_application == null)
                    return;

                ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass() as ISpatialReferenceFactory;
                m_wgs84 = spatialReferenceFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984) as ISpatialReference;

                //Get the editor.
                UID editorUid = new UID();
                editorUid.Value = "esriEditor.Editor";
                m_editor3 = m_application.FindExtensionByCLSID(editorUid) as IEditor3;
                m_editEvents2 = m_editor3 as IEditEvents2_Event;
                m_editEvents = m_editor3 as IEditEvents_Event;

                m_editEvents.OnCreateFeature += new IEditEvents_OnCreateFeatureEventHandler(m_editEvents_OnCreateFeature);
                m_editEvents.OnChangeFeature += new IEditEvents_OnChangeFeatureEventHandler(m_editEvents_OnChangeFeature);
                m_editEvents.OnDeleteFeature += new IEditEvents_OnDeleteFeatureEventHandler(m_editEvents_OnDeleteFeature);
                m_editEvents.OnStartEditing += new IEditEvents_OnStartEditingEventHandler(m_editEvents_OnStartEditing);

                resourceManager = new ResourceManager("ESRI.ArcGIS.OSM.Editor.OSMFeatureInspectorStrings", this.GetType().Assembly);
                _osmUtility = new OSMClassExtension.OSMUtility();

                // retrtrieve osm editor specfic information
                m_editorConfigurationSettings = OSMGPFactory.ReadOSMEditorSettings();
            }
            catch { }
        }
コード例 #59
0
        private ESRI.ArcGIS.Framework.IDockableWindow getDockableWindow()
        {
            // Only get/create the dockable window if they ask for it
            if (s_dockWindow == null)
            {
                UID dockWinID = new UID();
                dockWinID.Value = "A4WaterUtilities_LayerViewer";
                s_dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);
                //s_extension.UpdateSelCountDockWin()
            }

            return s_dockWindow;
        }
コード例 #60
0
    private void LoadCustomizations()
    {
      ICommandBar topMenuBar = GetMainBar();

      if (topMenuBar == null)
        return;

      // Add AcmeMenu
      UID uid = new UID();
      uid.Value = c_menuID;
      Object indexObj = Type.Missing;
      ICommandBar myMenu = topMenuBar.Add(uid, ref indexObj) as ICommandBar;
      ((ICommandItem)topMenuBar).Refresh();

      m_isMenuPresent = true;
    }