private void method_7(IGxObject igxObject_1) { ImageComboBoxItemEx ex; this.method_10(igxObject_1); this.bool_0 = false; if (igxObject_1.Parent is IGxCatalog) { for (int i = 0; i < this.imageComboBoxEdit1.Properties.Items.Count; i++) { ex = this.imageComboBoxEdit1.Properties.Items[i] as ImageComboBoxItemEx; if (ex.Tag == igxObject_1) { this.imageComboBoxEdit1.SelectedIndex = i; break; } } } else { ex = this.imageComboBoxEdit1.Properties.Items[this.imageComboBoxEdit1.SelectedIndex] as ImageComboBoxItemEx; int degree = ex.Degree; ex = new ImageComboBoxItemEx(igxObject_1.Name, igxObject_1.FullName, this.method_2(igxObject_1), degree + 1) { Tag = igxObject_1 }; this.imageComboBoxEdit1.Properties.Items.Insert(this.imageComboBoxEdit1.SelectedIndex + 1, ex); this.imageComboBoxEdit1.SelectedIndex++; } this.bool_0 = true; }
public bool CanChooseObject(IGxObject igxObject_0, ref MyDoubleClickResult myDoubleClickResult_0) { if ((igxObject_0 is IGxDiskConnection) || (igxObject_0 is IGxFolder)) { myDoubleClickResult_0 = MyDoubleClickResult.myDCRShowChildren; return(true); } if (igxObject_0 is IGxDatabase) { myDoubleClickResult_0 = MyDoubleClickResult.myDCRShowChildren; return(true); } if (igxObject_0 is IGxDataset) { switch ((igxObject_0 as IGxDataset).Type) { case esriDatasetType.esriDTFeatureDataset: myDoubleClickResult_0 = MyDoubleClickResult.myDCRShowChildren; return(true); case esriDatasetType.esriDTFeatureClass: myDoubleClickResult_0 = MyDoubleClickResult.myDCRChooseAndDismiss; return(true); } } return(false); }
public override void OnClick() { try { IGxObject firstObject = ((IGxSelection)_context.GxSelection).FirstObject; Cursor.Current = Cursors.WaitCursor; if (firstObject is IGxDatabase) { (firstObject as IGxDatabase).Connect(); } else if (firstObject is IGxAGSConnection) { (firstObject as IGxAGSConnection).Connect(); } else if (firstObject is IGxGDSConnection) { (firstObject as IGxGDSConnection).Connect(); } GxCatalogCommon.GetCatalog(firstObject).ObjectRefreshed(firstObject); } catch (Exception exception) { } Cursor.Current = Cursors.Default; }
private void method_19() { if (this.listView1.SelectedItems.Count > 0) { ListViewItem item = this.listView1.SelectedItems[0]; IGxObject tag = item.Tag as IGxObject; if ((tag != null) && (this.igxObjectFilter_0 != null)) { MyDoubleClickResult myDCRDefault = MyDoubleClickResult.myDCRDefault; this.igxObjectFilter_0.CanChooseObject(tag, ref myDCRDefault); if (myDCRDefault == MyDoubleClickResult.myDCRChooseAndDismiss) { this.iarray_1.RemoveAll(); this.iarray_1.Add(tag); this.ilist_0.Clear(); this.ilist_0.Add(tag); base.DialogResult = DialogResult.OK; ImageComboBoxItemEx selectedItem = this.imageComboBoxEdit1.SelectedItem as ImageComboBoxItemEx; if (selectedItem.Tag != null) { m_pStartingLocation = (selectedItem.Tag as IGxObject).FullName; } base.Close(); } } } }
public bool CanChooseObject(IGxObject igxObject_0, ref MyDoubleClickResult myDoubleClickResult_0) { if (!(igxObject_0 is IGxDataset)) { if (igxObject_0 is IGxLayer) { myDoubleClickResult_0 = MyDoubleClickResult.myDCRShowChildren; return(true); } if (igxObject_0 is IGxObjectContainer) { myDoubleClickResult_0 = MyDoubleClickResult.myDCRShowChildren; return(true); } return(false); } switch ((igxObject_0 as IGxDataset).DatasetName.Type) { case esriDatasetType.esriDTContainer: myDoubleClickResult_0 = MyDoubleClickResult.myDCRShowChildren; break; case esriDatasetType.esriDTFeatureDataset: case esriDatasetType.esriDTCadDrawing: myDoubleClickResult_0 = MyDoubleClickResult.myDCRChooseAndDismiss; break; default: myDoubleClickResult_0 = MyDoubleClickResult.myDCRChooseAndDismiss; break; } return(true); }
public bool CanDisplayObject(IGxObject igxObject_0) { if ((igxObject_0 is IGxDiskConnection) || (igxObject_0 is IGxFolder)) { return(true); } if (igxObject_0 is IGxDatabase) { return(true); } if (igxObject_0 is IGxDataset) { switch ((igxObject_0 as IGxDataset).Type) { case esriDatasetType.esriDTFeatureDataset: return(true); case esriDatasetType.esriDTFeatureClass: { IFeatureClass dataset = (igxObject_0 as IGxDataset).Dataset as IFeatureClass; if (dataset.ShapeType != esriGeometryType.esriGeometryPolyline) { dataset = null; break; } int index = dataset.FindField(dataset.ShapeFieldName); IField field = dataset.Fields.get_Field(index); dataset = null; return(field.GeometryDef.HasM); } } } return(false); }
public bool CanDisplayObject(IGxObject igxObject_0) { if ((igxObject_0 is IGxDiskConnection) || (igxObject_0 is IGxFolder)) { return(true); } if (igxObject_0 is IGxDatabase) { if ((igxObject_0 as IGxDatabase).IsRemoteDatabase) { return(true); } } else { if (igxObject_0 is IGxRemoteDatabaseFolder) { return(true); } if (igxObject_0 is IGxNewDatabase) { return(true); } if (igxObject_0 is IGxDataset) { return(true); } } return(false); }
public void Select(IGxObject igxObject_1, bool bool_1, object object_0) { if (!bool_1) { this.igxObjectArray_0.Empty(); } this.igxObjectArray_0.Insert(-1, igxObject_1); if (object_0 != null) { try { if (Convert.ToBoolean(object_0) && (this.OnSelectionChanged != null)) { this.OnSelectionChanged(this, igxObject_1); } } catch { } } else if (this.OnSelectionChanged != null) { this.OnSelectionChanged(this, igxObject_1); } }
private void btnSelectWorkspace_Click(object sender, EventArgs e) { frmOpenFile file = new frmOpenFile { Text = "选择工作空间" }; file.RemoveAllFilters(); file.AddFilter(new MyGxFilterWorkspaces(), true); if (file.DoModalOpen() == DialogResult.OK) { IArray items = file.Items; if (items.Count != 0) { IGxObject obj2 = items.get_Element(0) as IGxObject; if (obj2 is IGxDatabase) { this.iworkspace_0 = (obj2 as IGxDatabase).Workspace; } else if (obj2 is IGxFolder) { IWorkspaceName name = new WorkspaceNameClass { WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory", PathName = (obj2.InternalObjectName as IFileName).Path }; this.iworkspace_0 = (name as IName).Open() as IWorkspace; } this.txtWorkspaceName.Text = this.iworkspace_0.PathName; this.txtWorkspaceName.Tag = this.iworkspace_0; } } }
/// <summary> /// Recursively Publish metadata documents associated to a container /// </summary> /// <param name="item">The GxObject object</param> /// <param name="pr">The publication request object</param> private void publishMetadata(IGxObject item, PublicationRequest pr) { if (item is IGxObjectContainer && !item.Category.Trim().ToLower().StartsWith("arcgis server")) { IGxObjectContainer container = (IGxObjectContainer)item; IEnumGxObject children = container.Children; if (children == null) { writeResults(pr.publish(item)); return; } IGxObject child = children.Next(); while (child != null) { publishMetadata(child, pr); child = children.Next(); } } else { if (item is IMetadata) { writeResults(pr.publish(item)); } else { writeResults(pr.publish(item, pr.makeAgsUrl(item))); } } }
public bool CanDisplayObject(IGxObject igxObject_0) { if (igxObject_0 is IGxDataset) { esriDatasetType type = (igxObject_0 as IGxDataset).Type; if (type == esriDatasetType.esriDTFeatureDataset) { return(true); } if (igxObject_0 is GxCadDrawing) { return(false); } switch (type) { case esriDatasetType.esriDTFeatureClass: case esriDatasetType.esriDTCadDrawing: return(true); } } else if (igxObject_0 is IGxObjectContainer) { return(true); } return(false); }
private void CatalogView_Load(object sender, EventArgs e) { if (!base.DesignMode) { if (this.GxCatalog == null) { this.GxCatalog = new GxCatalog(); } this.kTreeView1.GxCatalog = this.GxCatalog; this.kTreeView1.InitTreeView(); string name = (this.GxCatalog as IGxObject).Name; this.imageComboBoxEdit1.Properties.SmallImages = this.imageList1; this.listView1.LargeImageList = this.imageList1; this.listView1.SmallImageList = this.imageList1; ImageComboBoxItemEx imageComboBoxItemEx = new ImageComboBoxItemEx(name, this.GxCatalog, this.GetImageIndex(this.GxCatalog as IGxObject), 0) { Tag = this.GxCatalog }; this.imageComboBoxEdit1.Properties.Items.Add(imageComboBoxItemEx); IEnumGxObject children = (this.GxCatalog as IGxObjectContainer).Children; children.Reset(); for (IGxObject i = children.Next(); i != null; i = children.Next()) { imageComboBoxItemEx = new ImageComboBoxItemEx(i.Name, i.FullName, this.GetImageIndex(i), 1) { Tag = i }; this.imageComboBoxEdit1.Properties.Items.Add(imageComboBoxItemEx); } this.imageComboBoxEdit1.SelectedIndex = 0; } }
public override void OnClick() { IGxObject firstObject = ((IGxSelection)_context.GxSelection).FirstObject; if (firstObject is IGxFile) { string path = (firstObject as IGxFile).Path; path = (path[path.Length - 1] != '\\' ? string.Concat(path, "\\新建文件型数据库") : string.Concat(path, "新建文件型数据库")); string str = string.Concat(path, ".gdb"); int num = 1; while (Directory.Exists(str)) { num++; str = string.Concat(path, " (", num.ToString(), ").gdb"); } IWorkspaceFactory fileGDBWorkspaceFactoryClass = new FileGDBWorkspaceFactory(); try { IWorkspaceName workspaceName = fileGDBWorkspaceFactoryClass.Create(Path.GetDirectoryName(str), Path.GetFileNameWithoutExtension(str), null, 0); IGxObject gxDatabase = new GxDatabase(); (gxDatabase as IGxDatabase).WorkspaceName = workspaceName; IGxCatalog catalog = GxCatalogCommon.GetCatalog(firstObject); gxDatabase.Attach(firstObject, catalog); catalog.ObjectAdded(gxDatabase); } catch (Exception exception) { MessageBox.Show(exception.Message); } } }
public override void OnClick() { IGxPasteTarget gxPasteTarget = ((IGxSelection)_context.GxSelection).FirstObject as IGxPasteTarget; if (gxPasteTarget != null) { bool flag = false; IEnumGxObject enumGxObject = CmdCopyItem.m_GxObjectContainer as IEnumGxObject; enumGxObject.Reset(); IGxObject gxObject = enumGxObject.Next(); IEnumNameEdit enumNameEdit = new NamesEnumerator() as IEnumNameEdit; while (gxObject != null) { enumNameEdit.Add(gxObject.InternalObjectName); gxObject = enumGxObject.Next(); } if (gxPasteTarget.CanPaste(enumNameEdit as IEnumName, ref flag)) { flag = false; gxPasteTarget.Paste(enumNameEdit as IEnumName, ref flag); } else { System.Windows.Forms.MessageBox.Show("无法粘贴打指定位置!"); } } }
private void EndLocation() { if (this.listView1.SelectedItems.Count > 0) { ListViewItem item = this.listView1.SelectedItems[0]; IGxObject tag = item.Tag as IGxObject; if ((tag != null) && (this._gxObjectFilter != null)) { MyDoubleClickResult myDCRDefault = MyDoubleClickResult.myDCRDefault; this._gxObjectFilter.CanChooseObject(tag, ref myDCRDefault); if (myDCRDefault == MyDoubleClickResult.myDCRChooseAndDismiss) { this._array2.RemoveAll(); this._array2.Add(tag); this._gxObjects.Clear(); this._gxObjects.Add(tag); base.DialogResult = DialogResult.OK; GISDataComboItem selectedItem = this.gisDataComboBox1.SelectedItem as GISDataComboItem; if (selectedItem.Tag != null) { _pStartLocation = (selectedItem.Tag as IGxObject).FullName; } base.Close(); } } } }
private void LoadGISDataCombo(IGxObject gxObject) { GISDataComboItem ex; this.LoadViewer(gxObject); this._isFree = false; if (gxObject.Parent is IGxCatalog) { for (int i = 0; i < this.gisDataComboBox1.Items.Count; i++) { ex = this.gisDataComboBox1.Items[i] as GISDataComboItem; if (ex.Tag == gxObject) { this.gisDataComboBox1.SelectedIndex = i; break; } } } else { ex = this.gisDataComboBox1.Items[this.gisDataComboBox1.SelectedIndex] as GISDataComboItem; int degree = ex.Level; ex = new GISDataComboItem(gxObject.Name, gxObject.FullName, this.GetImageIndex(gxObject), degree + 1) { Tag = gxObject }; this.gisDataComboBox1.AddChildNode(ex); this.gisDataComboBox1.SelectedIndex++; } this._isFree = true; }
private void PassListItem() { foreach (ListViewItem item in this.listView1.SelectedItems) { IGxObject tag = item.Tag as IGxObject; if (tag != null) { this._array2.Add(tag); this._gxObjects.Add(tag); } } base.DialogResult = DialogResult.OK; GISDataComboItem selectedItem = this.gisDataComboBox1.SelectedItem as GISDataComboItem; this._gxObject = selectedItem.Tag as IGxObject; _pStartLocation = this._gxObject.FullName; if (_pStartLocation != null) { StreamWriter writer = null; try { writer = File.CreateText(this._pStartFilePath); writer.WriteLine(_pStartLocation.ToString()); writer.Close(); } catch (Exception) { } } base.Close(); }
private void btnSelectOutLocation_Click(object sender, EventArgs e) { frmOpenFile file = new frmOpenFile { Text = "保存位置" }; file.RemoveAllFilters(); file.AddFilter(new MyGxFilterWorkspaces(), true); if (file.DoModalSaveLocation() == DialogResult.OK) { IArray items = file.Items; if (items.Count != 0) { this.igxObject_0 = items.get_Element(0) as IGxObject; this.iname_0 = this.igxObject_0.InternalObjectName; if (this.igxObject_0 is IGxDatabase) { this.iname_0 = this.igxObject_0.InternalObjectName; } else if (this.igxObject_0 is IGxFolder) { IWorkspaceName name = new WorkspaceNameClass { WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory", PathName = (this.igxObject_0.InternalObjectName as IFileName).Path }; this.iname_0 = name as IName; } this.txtOutLocation.Text = this.igxObject_0.FullName; } } }
public bool CanChooseObject(IGxObject igxObject_0, ref MyDoubleClickResult myDoubleClickResult_0) { if (igxObject_0 is IGxDataset) { esriDatasetType type = (igxObject_0 as IGxDataset).DatasetName.Type; if (type != esriDatasetType.esriDTContainer) { if (type != esriDatasetType.esriDTRasterDataset) { myDoubleClickResult_0 = MyDoubleClickResult.myDCRChooseAndDismiss; } else if ((igxObject_0 as IGxDataset).Dataset != null) { myDoubleClickResult_0 = MyDoubleClickResult.myDCRChooseAndDismiss; } } else { myDoubleClickResult_0 = MyDoubleClickResult.myDCRShowChildren; } return(true); } if (igxObject_0 is IGxObjectContainer) { myDoubleClickResult_0 = MyDoubleClickResult.myDCRShowChildren; return(true); } return(false); }
private void ComboBoxHandle() { ImageComboBoxItemEx item = this.imageComboBoxEdit1.Properties.Items[this.imageComboBoxEdit1.SelectedIndex] as ImageComboBoxItemEx; IGxObject tag = item.Tag as IGxObject; for (int i = this.imageComboBoxEdit1.Properties.Items.Count - 1; i > 0; i--) { item = this.imageComboBoxEdit1.Properties.Items[i] as ImageComboBoxItemEx; IGxObject gxObject = item.Tag as IGxObject; if (!(gxObject is IGxCatalog)) { if (!(gxObject.Parent is IGxCatalog)) { if (gxObject != tag) { if (!this.IsAncestors(gxObject, tag)) { this.imageComboBoxEdit1.Properties.Items.RemoveAt(i); } } } } } }
private void LoadChildren() { if (m_childrenLoaded) { return; } //Our children are GxContainer objects that represent class folders //for all the different types of styles. Loop over each of these //types, and create a clsGxStyleGalleryClass object for it, and attach it to the //tree correctly. int i = 0; int tempFor1 = m_pGallery.ClassCount; for (i = 0; i < tempFor1; i++) { CustomRootObject_CS.clsGxStyleGalleryClass pGxClass = null; pGxClass = new CustomRootObject_CS.clsGxStyleGalleryClass(); pGxClass.StyleGalleryClass = (IStyleGalleryClass)m_pGallery.get_Class(i); IGxObject pGxObject = null; pGxObject = pGxClass; pGxObject.Attach(this, m_pCatalog); m_pChildren.Insert(-1, pGxObject); } m_childrenLoaded = true; }
public void Refresh() { IGxSelection pGxSelection = null; IGxObject pLocation = null; pGxSelection = m_pSelection; pLocation = pGxSelection.Location; //Clean up frmTextView.txtContents.Clear(); string fname = null; fname = pLocation.Name.ToLower(); if (fname.IndexOf(".txt") != -1) { try { frmTextView.txtContents.Text = System.IO.File.ReadAllText(pLocation.FullName); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } finally { pGxSelection = null; pLocation = null; } } }
/// <summary> /// Opens a dialog so the user can select a dataset containing the new data to be transformed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void inputDatasetButton_Click(object sender, EventArgs e) { try { IGxObjectFilter datasetFilter = new GxFilterFeatureDatasetsClass(); IGxDialog dlg = new GxDialogClass(); IGxObjectFilterCollection filters = (IGxObjectFilterCollection)dlg; filters.AddFilter(datasetFilter, true); dlg.Title = "Select the feature dataset containing the data to be transformed"; dlg.ButtonCaption = "Select"; IEnumGxObject objects = null; if (dlg.DoModalOpen(0, out objects)) { IGxObject obj = objects.Next(); _inputDatasetName = (IFeatureDatasetName2)obj.InternalObjectName; inputDatasetTextBox.Text = obj.Parent.Name + "/" + obj.Name; List <IDatasetName> fcNames = EsriUtilities.GetFeatureClassNames(esriGeometryType.esriGeometryPoint, _inputDatasetName); fcNames.Sort(_nameComparer); controlPointsComboBox.DataSource = fcNames; controlPointsComboBox.DisplayMember = "Name"; EnableSave(); } } catch (Exception ex) { ShowError(ex.Message); } }
private void btnSelectInputFeatures_Click(object sender, EventArgs e) { frmOpenFile file = new frmOpenFile { Text = "选择要素" }; file.RemoveAllFilters(); file.AddFilter(new MyGxFilterDatasets(), true); if (file.DoModalOpen() == DialogResult.OK) { IArray items = file.Items; if (items.Count == 0) { return; } IGxObject obj2 = items.get_Element(0) as IGxObject; this.txtInputFeatureClass.Text = obj2.FullName; this.txtInputFeatureClass.Tag = obj2; } if (this.txtInputFeatureClass.Text.Length > 0) { this.btnAdd.Enabled = true; } }
/// <summary> /// Opens a dialog so the user can select an output workspace. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void outputWorkspaceButton_Click(object sender, EventArgs e) { try { IGxObjectFilter geodatabaseFilter = new GxFilterFileGeodatabasesClass(); IGxDialog dlg = new GxDialogClass(); IGxObjectFilterCollection filters = (IGxObjectFilterCollection)dlg; filters.AddFilter(geodatabaseFilter, false); dlg.Title = "Select the file geodatabase for the output"; dlg.ButtonCaption = "Select"; IEnumGxObject objects = null; if (dlg.DoModalOpen(0, out objects)) { IGxObject obj = objects.Next(); IWorkspaceFactory2 workspaceFactory = new FileGDBWorkspaceFactoryClass(); IFeatureWorkspace workspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(obj.FullName, 0); _transform.SetWorkspace(workspace); outputWorkspaceTextBox.Text = obj.Name; EnableSave(); } } catch (Exception ex) { ShowError(ex.Message); } }
public void Attach(IGxObject Parent, IGxCatalog pCatalog) { m_parentCatalog = pCatalog; m_parentObject = Parent; this.Refresh(); //throw new Exception("The method or operation is not implemented."); }
private void method_0(IGxSelection igxSelection_1, object object_0) { if (this.igxSelection_0 == igxSelection_1) { this.igxObject_0 = igxSelection_1.FirstObject; } }
private void method_4() { foreach (ListViewItem item in this.listView1.SelectedItems) { IGxObject tag = item.Tag as IGxObject; if (tag != null) { this.iarray_1.Add(tag); this.ilist_0.Add(tag); } } base.DialogResult = DialogResult.OK; ImageComboBoxItemEx selectedItem = this.imageComboBoxEdit1.SelectedItem as ImageComboBoxItemEx; this.igxObject_0 = selectedItem.Tag as IGxObject; m_pStartingLocation = this.igxObject_0.FullName; if (m_pStartingLocation != null) { StreamWriter writer = null; try { writer = File.CreateText(this.string_1); writer.WriteLine(m_pStartingLocation.ToString()); writer.Close(); } catch (Exception) { } } base.Close(); }
private void LoadChildren() { if (m_childrenLoaded) { return; } //Our children are GxContainer objects that represent the actual style items //of a certain type. IEnumStyleGalleryItem pEnumItems = null; pEnumItems = m_pParent.StyleGallery.get_Items(m_pClass.Name, "ESRI.style", ""); IStyleGalleryItem pItem = null; pItem = pEnumItems.Next(); while (pItem != null) { clsGxStyleGalleryItem pGxItem = null; pGxItem = new clsGxStyleGalleryItem(); pGxItem.StyleGalleryItem = pItem; IGxObject pGxObject = null; pGxObject = pGxItem; pGxObject.Attach(this, m_pCatalog); m_pChildren.Insert(-1, pGxObject); pItem = pEnumItems.Next(); } m_childrenLoaded = true; }
public bool CanSaveObject(IGxObject igxObject_0, string string_0, ref bool bool_0) { try { if ((igxObject_0 is IGxDiskConnection) || (igxObject_0 is IGxFolder)) { string path = (igxObject_0 as IGxFile).Path + @"\" + string_0; bool_0 = File.Exists(path); return(true); } if (igxObject_0 is IGxDatabase) { bool_0 = ((igxObject_0 as IGxDatabase).Workspace as IWorkspace2).get_NameExists( esriDatasetType.esriDTFeatureClass, string_0); return(true); } if ((igxObject_0 is IGxDataset) && ((igxObject_0 as IGxDataset).Type == esriDatasetType.esriDTFeatureDataset)) { bool_0 = ((igxObject_0 as IGxDataset).Dataset.Workspace as IWorkspace2).get_NameExists( esriDatasetType.esriDTFeatureClass, string_0); return(true); } } catch { } return(false); }
public bool CanDisplayObject(IGxObject @object) { if (@object.Name.ToLower().Contains(this.Filter.ToLower())) return true; else return false; }
public bool CanChooseObject(IGxObject @object, ref esriDoubleClickResult result) { bool canChoose = false; if (@object == null) { return canChoose; } IGxFile gxFile = @object as IGxFile; if (gxFile == null) return false; if (gxFile.Path.EndsWith(".xml")) canChoose = true; return canChoose; }
public String makeAgsUrl(IGxObject pGxObject) { String entity = ""; String server = pGxObject.Parent.Parent.Category; String category = pGxObject.Category; String s = ""; String agsServerUrl = ""; int httpIndex = server.ToLower().IndexOf("http:"); int httpsIndex = server.ToLower().IndexOf("https:"); bool isLeafLevelService = false; if (httpIndex == -1 && httpsIndex == -1) { server = pGxObject.Parent.Category; httpIndex = server.ToLower().IndexOf("http:"); httpsIndex = server.ToLower().IndexOf("https:"); isLeafLevelService = true; } if (httpIndex > -1) { s = server.Substring(server.IndexOf("http:")).ToLower(); } else if (httpsIndex > -1) { s = server.Substring(server.IndexOf("https:")).ToLower(); } if (category.Equals("Map Service", System.StringComparison.CurrentCultureIgnoreCase)) { s = s.Replace("arcgis/services", "arcgis/rest/services"); if (!isLeafLevelService) { agsServerUrl = s + "/" + pGxObject.Parent.BaseName + "/" + pGxObject.BaseName + "/MapServer"; } else { agsServerUrl = s + "/" + pGxObject.BaseName + "/MapServer"; } } else if (category.Equals("Geodata Service", System.StringComparison.CurrentCultureIgnoreCase)) { s = s.Replace("arcgis/services", "arcgis/rest/services"); if (!isLeafLevelService) { agsServerUrl = s + "/" + pGxObject.Parent.BaseName + "/" + pGxObject.BaseName + "/GeoDataServer"; } else { agsServerUrl = s + "/" + pGxObject.BaseName + "/GeoDataServer"; } } else if (category.Equals("Geometry Service", System.StringComparison.CurrentCultureIgnoreCase)) { s = s.Replace("arcgis/services", "arcgis/rest/services"); if (!isLeafLevelService) { agsServerUrl = s + "/" + pGxObject.Parent.BaseName + "/" + pGxObject.BaseName + "/GeometryServer"; } else { agsServerUrl = s + "/" + pGxObject.BaseName + "/GeometryServer"; } } else if (category.Equals("Geocode Service", System.StringComparison.CurrentCultureIgnoreCase)) { s = s.Replace("arcgis/services", "arcgis/rest/services"); if (!isLeafLevelService) { agsServerUrl = s + "/" + pGxObject.Parent.BaseName + "/" + pGxObject.BaseName + "/GeocodeServer"; } else { agsServerUrl = s + "/" + pGxObject.BaseName + "/GeocodeServer"; } } else if (category.Equals("Geoprocessing Service", System.StringComparison.CurrentCultureIgnoreCase)) { s = s.Replace("arcgis/services", "arcgis/rest/services"); if (!isLeafLevelService) { agsServerUrl = s + "/" + pGxObject.Parent.BaseName + "/" + pGxObject.BaseName + "/GPServer"; } else { agsServerUrl = s + "/" + pGxObject.BaseName + "/GPServer"; } } else if (category.Equals("Globe Service", System.StringComparison.CurrentCultureIgnoreCase)) { s = s.Replace("arcgis/services", "arcgis/rest/services"); if (!isLeafLevelService) { agsServerUrl = s + "/" + pGxObject.Parent.BaseName + "/" + pGxObject.BaseName + "/GlobeServer"; } else { agsServerUrl = s + "/" + pGxObject.BaseName + "/GlobeServer"; } } else if (category.Equals("Image Service", System.StringComparison.CurrentCultureIgnoreCase)) { s = s.Replace("arcgis/services", "arcgis/rest/services"); if (!isLeafLevelService) { agsServerUrl = s + "/" + pGxObject.Parent.BaseName + "/" + pGxObject.BaseName + "/ImageServer"; } else { agsServerUrl = s + "/" + pGxObject.BaseName + "/ImageServer"; } } else if (category.Equals("Network Service", System.StringComparison.CurrentCultureIgnoreCase)) { s = s.Replace("arcgis/services", "arcgis/rest/services"); if (!isLeafLevelService) { agsServerUrl = s + "/" + pGxObject.Parent.BaseName + "/" + pGxObject.BaseName + "/NetworkServer"; } else { agsServerUrl = s + "/" + pGxObject.BaseName + "/NetworkServer"; } } else if (category.StartsWith("ArcGIS Server Folder", System.StringComparison.CurrentCultureIgnoreCase)) { server = pGxObject.Parent.Category; httpIndex = server.ToLower().IndexOf("http:"); httpsIndex = server.ToLower().IndexOf("https:"); if (httpIndex > -1) { s = server.Substring(server.IndexOf("http:")).ToLower(); } else if (httpsIndex > -1) { s = server.Substring(server.IndexOf("https:")).ToLower(); } s = s.Replace("arcgis/services", "arcgis/rest/services"); agsServerUrl = s + "/" + pGxObject.BaseName; } else if (category.StartsWith("ArcGIS Server", System.StringComparison.CurrentCultureIgnoreCase)) { server = pGxObject.Category; httpIndex = server.ToLower().IndexOf("http:"); httpsIndex = server.ToLower().IndexOf("https:"); if (httpIndex > -1) { s = server.Substring(server.IndexOf("http:")).ToLower(); } else if (httpsIndex > -1) { s = server.Substring(server.IndexOf("https:")).ToLower(); } s = s.Replace("arcgis/services", "arcgis/rest/services"); agsServerUrl = s; } entity += "url=" + agsServerUrl + "&name=" + pGxObject.Name; // endPoint = "SERVLET CONNECTOR"; return entity; }
/// <summary> /// Extracts metadata xml of entity and send publication request to server. /// </summary> /// <param name="entity">Entity to publish</param> /// <returns>Publish results</returns> public string[] publish(IGxObject entity) { string[] results = new string[1]; IMetadata metaData = (IMetadata)entity; //Get the xml property set from the metadata IXmlPropertySet2 xml = (IXmlPropertySet2)metaData.Metadata; if (TranslateMetadata(xml, out xmlFilePaths)) { string sXml = ""; if (translatorPath.Trim().Length == 0) { sXml = File.ReadAllText(xmlFilePaths[0], Encoding.UTF8); /// untransformed xml no translator configured. }else{ sXml = File.ReadAllText(xmlFilePaths[1], Encoding.UTF8); /// transformed xml. } return publish(entity, sXml); } else { results[0] = StringMessages.ErrorOnTranslation; return results; } }
/// <summary> /// Sends publication request to server. /// </summary> /// <param name="entity">Entity to publish</param> /// <param name="sXml">metadata sml</param> /// <returns>Publish results</returns> public string[] publish(IGxObject entity, String sXml) { string[] results = new string[1]; String resp = null; string sUrl = parameters.ServerUrl.Trim(); // string endPoint = determineEndPoint(); #region Cascade EndPoint if (endPoint == "REST" || endPoint == "DEFAULT") { if (endPoint == "DEFAULT") { sUrl += "/rest/manage/document"; } resp = SubmitHttpRequest(sXml, sUrl); if (resp.ToLower().Contains("error") || resp.ToLower().Contains("exception")) { String[] parts = sUrl.Split(new String[] { "/rest/manage/document" }, StringSplitOptions.RemoveEmptyEntries); sUrl = parts[0] + "/csw/publication"; endPoint = "CSW"; } } if (endPoint == "CSW") { makeCswInsertRequest(ref sXml); resp = SubmitHttpRequest(sXml, sUrl); if (resp.ToLower().Contains("error") || resp.ToLower().Contains("exception")) { String[] parts = null; if (sUrl.ToLower().EndsWith("/csw")) { sUrl = sUrl; } else if(sUrl.Contains("/csw/publication")) parts = sUrl.Split(new String[] { "/csw/publication" }, StringSplitOptions.RemoveEmptyEntries); else parts = sUrl.Split(new String[] { "/csw202/publication" }, StringSplitOptions.RemoveEmptyEntries); sUrl = parts[0]; endPoint = "SERVLET CONNECTOR"; } } else if (endPoint == "CSW SOAP") { makeCswSOAPInsertRequest(ref sXml); resp = SubmitHttpRequest(sXml, sUrl); if (resp.ToLower().Contains("error") || resp.ToLower().Contains("exception")) { String[] parts = null; if (sUrl.Contains("/csw/publication/soap")) parts = sUrl.Split(new String[] { "/csw/publication/soap" }, StringSplitOptions.RemoveEmptyEntries); else parts = sUrl.Split(new String[] { "/csw202/publication/soap" }, StringSplitOptions.RemoveEmptyEntries); sUrl = parts[0]; endPoint = "SERVLET CONNECTOR"; } } if(endPoint == "SERVLET CONNECTOR") { // /servlet/com.esri.esrimap.Esrimap?servicename=login string baseUrl = sUrl; sUrl += "/com.esri.esrimap.Esrimap?servicename=login"; SubmitHttpRequest(sXml, sUrl); sUrl = baseUrl + "/com.esri.esrimap.Esrimap?servicename=" + parameters.Service + ":EB:" + entity.FullName; makeArcXmlRequest(ref sXml); resp = SubmitHttpRequest(sXml, sUrl); } PublishForm.Logger.writeLog("EndPoint Type : " + endPoint); PublishForm.Logger.writeLog("Publish url : " + sUrl); PublishForm.Logger.writeLog("Publish request : " + sXml); PublishForm.Logger.writeLog("Publish response : " + resp); #endregion if (resp.ToLower().Contains("error") || resp.ToLower().Contains("exception") || resp.ToLower().Contains("e-r-r-o-r")) { resp = resp.Replace("e-r-r-o-r", "error"); results[0] = StringMessages.PublishFailure + " " + entity.FullName + "\n Cause : " + resp; } else results[0] = StringMessages.PublishSuccess + " " + entity.FullName; return results; }
/// <summary> /// Extracts metadata xml of entity and send publication request to server. /// </summary> /// <param name="entity">Entity to publish</param> /// <returns>Publish results</returns> public string[] publish(IGxObject entity) { string[] results = new string[1]; IMetadata metaData = (IMetadata)entity; //Get the xml property set from the metadata IXmlPropertySet2 xml = (IXmlPropertySet2)metaData.Metadata; string[] xmlFilePaths; TranslateMetadata(xml, out xmlFilePaths); string sXml = File.ReadAllText(xmlFilePaths[0], Encoding.UTF8); /// untransformed xml. return publish(entity, sXml); }
public void Attach(ESRI.ArcGIS.Catalog.IGxObject Parent, ESRI.ArcGIS.Catalog.IGxCatalog pCatalog) { m_pParent = Parent; m_pCatalog = pCatalog; }
public void Detach() { m_gxParent = null; m_gxCatalog = null; }
public void DeleteChild(IGxObject child) { throw new Exception("The method or operation is not implemented."); }
private IGxObject getGxObjects(IGxObject currentobject, System.String objName) { try { if (currentobject.BaseName == objName) return currentobject; if (currentobject is IGxObjectContainer) { IGxObjectContainer gxObjCont = null; IEnumGxObject gxEnum = null; IGxObject gxObject = null; gxObjCont = currentobject as IGxObjectContainer; gxEnum = gxObjCont.Children; if (gxEnum != null) { gxObject = gxEnum.Next(); while (gxObject != null) { if (gxObject.BaseName == objName) return gxObject; if (currentobject is IGxObjectContainer) { IGxObject newobj = getGxObjects(gxObject, objName); //if (newobj != null) getGxObjects(newobj, objName); } gxObject = gxEnum.Next(); } } } return null; } catch (Exception ex) { MessageBox.Show("Failed to get catalog object: " + objName + Environment.NewLine + ex.Message); return null; } }
private void runTool(IGxObject gxObj) { try { if (gxObj == null) return; if (gxObj is IGxGPTool) { IGxGPTool gxGPTool = (IGxGPTool)gxObj; IGPTool gpTool = gxGPTool.Tool; runTool(gpTool.Name); } else if (gxObj is GxAddGDSConnection) { IGxObjectWizard gxWiz = (IGxObjectWizard)gxObj; gxWiz.Invoke(ArcCatalog.Application.hWnd); } } catch (Exception ex) { } }
public bool CanDisplayObject(IGxObject @object) { bool canDisplay = false; if (@object == null) { return canDisplay; } IGxFile gxFile = @object as IGxFile; if (gxFile != null) { if (gxFile.Path.EndsWith(".xml")) { canDisplay = true; } } IGxFolder gxFolder = @object as IGxFolder; if (gxFolder != null) { canDisplay = true; } return canDisplay; }
void cleanUp() { //m_pWSF = null; m_pWS = null; m_pSDT = null; m_pSDS = null; m_pSB = null; m_pB = null; m_SelectedObject = null; templateInfo = null; m_pSDI = null; formNames = null; formReduce = null; m_sfn = ""; blnCancel = false; strLayers = ""; strNodeLayers = ""; }
protected override void OnClick() { blnCancel = false; formNames = new frmDatasetTemplateName(); formNames.cancelFormEvent += new EventHandler(formNames_cancelFormEvent); formNames.nextFormEvent += new EventHandler<NameEvents>(formNames_nextFormEvent); m_SelectedObject = ArcCatalog.ThisApplication.SelectedObject; if ((m_SelectedObject.Category == "Schematic Dataset") || (m_SelectedObject.Category.ToLower().Contains("database"))) { if (m_SelectedObject.Category.ToLower().Contains("database")) { //get dataset and template names, then create the objects formNames.blnNewDataset = true; } else { //dataset, just get template names, then create objects formNames.blnNewDataset = false; } //show the first form of the wizard if (formNames.ShowDialog() == DialogResult.Cancel) { formNames = null; return; } } else { //we are not on a database or a schematic dataset blnCancel = true; } if (blnCancel == true) { System.Windows.Forms.MessageBox.Show("The name of the dataset or template already exists. Please try again with valid names."); } if (blnCancel != true) //only true if the user cancels the first form formNames_cancelFormEvent { System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; IEnumLayer pEnumLayer = GetLayers(); if (pEnumLayer == null) { //should only happen if the user clicks cancel on the gxdialog blnCancel = true; } else { strLayers = CreateSchLayers(pEnumLayer); if (strLayers.Length > 0) //make sure we get something back { //find out if we need to create node reduction rules formReduce = new frmSelectItemsToReduce(); formReduce.doneFormEvent += new EventHandler<ReduceEvents>(formReduce_doneFormEvent); formReduce.cancelFormEvent += new EventHandler(formReduce_cancelFormEvent); formReduce.itemList = strNodeLayers; System.Windows.Forms.Cursor.Current = Cursors.Default; formReduce.ShowDialog(); } else { //this can happen if the map document didn't have any //layers corresponding to a geometric network blnCancel = true; } } System.Windows.Forms.Cursor.Current = Cursors.Default; } if (blnCancel != true) //could have cancelled on either frmDatasetTemplateName or frmSelectItemsToReduce { //Advanced Form formAdvanced = new frmAdvanced(); formAdvanced.doneFormEvent += new EventHandler<AdvancedEvents>(formAdvanced_doneFormEvent); formAdvanced.strLayers = this.strLayers; formAdvanced.strNodeLayers = this.strNodeLayers; formAdvanced.m_myCol = this.m_myCol; formAdvanced.ShowDialog(); } ArcCatalog.ThisApplication.Refresh(m_sfn); try { ArcCatalog.ThisApplication.Location = m_SelectedObject.FullName.ToString(); } catch { } cleanUp(); }
public IGxObject AddChild(IGxObject child) { m_children.Insert(-1, child); return child; }
public void Attach(IGxObject Parent, IGxCatalog pCatalog) { m_gxParent = Parent; m_gxCatalog = pCatalog; }
public void Attach(IGxObject Parent, IGxCatalog pCatalog) { m_parentCatalog = pCatalog; m_parentObject = Parent; //this.Refresh(); //throw new Exception("The method or operation is not implemented."); }
public override void Attach(IGxObject Parent, IGxCatalog pCatalog) { base.Attach(Parent, pCatalog); }
public bool CanSaveObject(IGxObject Location, string newObjectName, ref bool objectAlreadyExists) { return false; }
public void Detach() { //It is our responsibility to detach all of our children before deleting //them. This is to avoid circular referencing problems. int i = 0; int tempFor1 = m_pChildren.Count; for (i = 0; i <= tempFor1; i++) { m_pChildren.Item(i).Detach(); } m_pParent = null; m_pCatalog = null; }
public bool CanChooseObject(IGxObject @object, ref esriDoubleClickResult result) { throw new NotImplementedException(); }
public bool CanSaveObject(IGxObject Location, string newObjectName, ref bool objectAlreadyExists) { throw new NotImplementedException(); }