public override bool RemoveItem(ICatalogItem item, bool removeOther) { if (item == null || _treeView.Nodes.Count == 0) { return(true); } RadTreeNode[] nodes = FindNodes(Path.GetFileName(item.FileName)); //by chennan 20120814 今日监测分析面板中文显示 //RadTreeNode[] nodes = _treeView.FindNodes(Path.GetFileName(item.FileName)); if (nodes == null || nodes.Length == 0) { return(false); } List <RadTreeNode> tempNodes = new List <RadTreeNode>(); tempNodes.AddRange(nodes); foreach (RadTreeNode node in tempNodes) { if (node.Tag == null || string.IsNullOrEmpty(node.Tag.ToString())) { continue; } if (node.Tag.ToString().ToUpper() == item.FileName.ToUpper()) { node.Remove(); } } if (removeOther) { RemoveOtherCatalog(item, false); } return(true); }
public bool IsExist(ICatalogItem item, bool isRemove) { if (item == null || string.IsNullOrEmpty(item.FileName)) { return(false); } if (item.Info.Properties.ContainsKey("SubProductIdentify")) { object v = item.Info.Properties["SubProductIdentify"]; string identify = v != null?v.ToString() : null; if (_catalogNodes.ContainsKey(identify)) { RadTreeNode tn = _catalogNodes[identify]; foreach (RadTreeNode t in tn.Nodes) { if (t.Tag != null && t.Tag.ToString() == item.FileName) { if (isRemove) { tn.Nodes.Remove(t); } return(true); } } } } return(false); }
public void Write(XmlWriter xmlWriter, ICatalogItem item) { Patent patent = item as Patent; if (patent == null) { throw new WriteException($"For {item.GetType().Name}, no writing format is defined"); } XMLUtilite.CheckFields(patent); XElement xPatent = new XElement("patent", new XElement("name", patent.Name), new XElement("authors", patent.Author?.Select(a => new XElement("name", a.Name))), new XElement("country", patent.Country), new XElement("registrationNamber", patent.RegistrationNamber), new XElement("filingDate", patent.FilingDate.Value.ToString("yyyy-MM-dd")), new XElement("publicationDate", patent.PublicationDate.Value.ToString("yyyy-MM-dd")), new XElement("pageCount", patent.PageCount), new XElement("remark", patent.Remark)); xPatent.WriteTo(xmlWriter); }
public override string ToString(object value) { ICatalogItem ci = value as ICatalogItem; if (ci is CatalogLocal) { return((ci as CatalogLocal).Tag.ToString()); } else if (ci is CatalogFile) { return((ci as CatalogFile).Tag.ToString()); } else if (ci is CatalogDatabaseConn) { return(((ci as CatalogDatabaseConn).Tag as SpatialDatabaseConn).ConnectionString); } else if (ci is CatalogFeatureDataset) { SpatialFeatureDataset sfd = (ci as CatalogFeatureDataset).Tag as SpatialFeatureDataset; return((sfd as CatalogEntityBase)._connString + "@" + sfd.Name); } else if (ci is CatalogFeatureClass) { SpatialFeatureClass sfc = (ci as CatalogFeatureClass).Tag as SpatialFeatureClass; return((sfc as CatalogEntityBase)._connString + "@" + sfc.Name); } else { return(base.ToString()); } }
public int GetParameterCatalogID(string parameterName) { parameterName = parameterName.ToUpper(); ICatalogItem item = (ICatalogItem)(this._parameters[parameterName]); return(System.Convert.ToInt32(item.ID)); }
void treeView1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { TreeNode tn = treeView1.SelectedNode; if (tn == null) { return; } ICatalogItem c = tn.Tag as ICatalogItem; ContextOprItem[] oprs = c.ContextOprItems; if (oprs == null || oprs.Length == 0) { return; } contextMenuStrip1.Items.Clear(); foreach (ContextOprItem op in oprs) { if (op == null) { contextMenuStrip1.Items.Add(new ToolStripSeparator()); } else { ToolStripMenuItem it = new ToolStripMenuItem(op.Name, op.Image); it.Tag = new object[] { op, c }; it.Click += new EventHandler(it_Click); contextMenuStrip1.Items.Add(it); } } contextMenuStrip1.Show(treeView1, e.Location); } }
// Initiate Purchase internal void PurchaseItem(ICatalogItem item) { if (item.IsNativeCatalog) { // Use Unity IAP for real money purchases controller.InitiatePurchase(((NativeCatalogItem)item).item); } else { // PlayFab purcahse using virtual currency var catalogItem = ((PlayFabCatalogItem)item).item; var request = new PurchaseItemRequest { ItemId = catalogItem.ItemId, Price = (int)catalogItem.VirtualCurrencyPrices[cVC], StoreId = cStoreId, VirtualCurrency = cVC }; PlayFabClientAPI.PurchaseItem(request, OnPurchaseSuccess, OnError); spinnerScreen.SetActive(true); } }
/// <param name="catalog"></param> /// <returns></returns> private string GenralReportInfos(ICatalogItem catalog) { MonitorProductInfo info = new MonitorProductInfo(); //fir ,fog info.productType = catalog.Info.GetPropertyValue("ProductIdentify"); //tjcp:统计产品 xxcp;信息列表 sgcp:栅格产品 ztcp:专题产品 slcp:矢量产品 dhcp:动画产品 info.productDataType = catalog.Info.GetPropertyValue("CatalogDef"); //VectorProduct、 info.productIdentify = catalog.Info.GetPropertyValue("SubProductIdentify"); //DBLV,0CSR,"PLST"; info.productIdentifyName = catalog.Info.GetPropertyValue("CatalogItemCN"); //"火点二值图"; info.satellite = catalog.Info.GetPropertyValue("Satellite"); info.sensor = catalog.Info.GetPropertyValue("Sensor"); info.subProductType = ""; //通常为空 info.orbitDateTime = DateTime.Parse(catalog.Info.GetPropertyValue("OrbitDateTime")); info.productArea = catalog.Info.GetPropertyValue("Region"); string dir = "\\" + dateTimePicker1.Value.ToString("yyyyMMdd") + "\\" + cbSubFolder.Text; if (catalog.Info.Properties.ContainsKey(CatalogTreeView.ToReportInfoKey)) { catalog.Info.Properties[CatalogTreeView.ToReportInfoKey] = CatalogTreeView.ToReportInfoValue; } else { catalog.Info.Properties.Add(CatalogTreeView.ToReportInfoKey, CatalogTreeView.ToReportInfoValue); } string infoFilename = System.IO.Path.ChangeExtension(catalog.FileName, ".info"); catalog.Info.SaveTo(infoFilename); CopyFile(dir, catalog.FileName); string productFilename = System.IO.Path.GetFileName(catalog.FileName); info.productFileName = productFilename; info.productFilePath = dir; return(dir); }
public static IDataSource OpenDataSource() { using (frmDataSource frm = new frmDataSource()) { frm.ucBudGISDataSource1.SelectableType = enumCatalogItemType.FeatureClass; if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ICatalogItem citem = frm.ucBudGISDataSource1.SelectedCatalogItem; if (citem is CatalogFile) { return(GetDataSource(citem as CatalogFile)); } else if (citem is CatalogFeatureClass) { return(GetDataSource(citem as CatalogFeatureClass)); } else if (citem is CatalogNetFeatureClass) { return(GetDataSource(citem as CatalogNetFeatureClass)); } else { throw new NotSupportedException("暂时不支持类型为\"" + citem.Tag.ToString() + "\"的数据源。"); } } } return(null); }
public void Write(XmlWriter xmlWriter, ICatalogItem item) { Newspaper newspaper = item as Newspaper; if (newspaper == null) { throw new WriteException($"For {item.GetType().Name}, no writing format is defined"); } XMLUtilite.CheckFields(newspaper); XElement xNewspaper = new XElement("newspaper", new XElement("name", newspaper.Name), new XElement("publicationPlace", newspaper.PublicationPlace), new XElement("publisherName", newspaper.PublisherName), new XElement("publicationYear", newspaper.PublicationYear), new XElement("pageCount", newspaper.PageCount), new XElement("remark", newspaper.Remark), new XElement("number", newspaper.Number), new XElement("date", newspaper.Date.Value.ToString("yyyy-MM-dd")), new XElement("issn", newspaper.ISSN)); xNewspaper.WriteTo(xmlWriter); }
public NormalCatalog(DateTime dateCreation, ICatalogItem catalogItem, int pages) { idCatalog = ++Seed; this.dateCreation = dateCreation; this.catalogItem = catalogItem; this.pages = pages; }
public override bool IsExist(ICatalogItem item) { //if (_listView.Items == null || _listView.Items.Count == 0 || item == null || string.IsNullOrEmpty(item.FileName)) // return false; //foreach (var v in _listView.Items) //{ // ItemInfoListViewDataItem data = v as ItemInfoListViewDataItem; // if (data == null || data.Tag == null) // continue; // if (data.Tag.ToString() == item.FileName) // { // //选中条目 // _listView.SelectedItem = data; // return true; // } //} //return false; ItemInfoListViewDataItem data = IsExist(item, true); if (data == null) { return(false); } else { return(true); } }
public void Initialize(ICatalogItem catalogItem, Vector3 position) { item = catalogItem; var image = GetComponentInChildren <Image>(); var texture = Resources.Load <Texture2D>("icon_" + getIconFromItemId(catalogItem.Id)); image.sprite = Sprite.Create(texture, image.sprite.rect, image.sprite.pivot); var itemName = GetComponentInChildren <Text>(); itemName.text = catalogItem.DisplayName; RefreshPrice(); var purchaseButton = GetComponentInChildren <Button>(); purchaseButton.onClick.AddListener(() => { PlayFabCommerceManager.Instance.PurchaseItem(item); }); (transform as RectTransform).position = position; }
public override bool RemoveItem(ICatalogItem item, bool removeOther) { if (item == null || _listView.Items.Count == 0) { return(true); } ItemInfoListViewDataItem tag = null; List <ListViewDataItem> temp = new List <ListViewDataItem>(); temp.AddRange(_listView.Items); foreach (ListViewDataItem lvi in temp) { tag = lvi as ItemInfoListViewDataItem; if (tag == null) { continue; } if (tag.Tag.ToString().ToUpper() == item.FileName.ToUpper()) { _listView.Items.Remove(lvi); } } if (removeOther) { RemoveOtherCatalog(item, false); } return(true); }
//public FeatureDatasetCatalogItem(IDataset dsFeatureDataset, ICatalogItem parent):base(dsFeatureDataset,parent) //{ // if (!(dsFeatureDataset is IFeatureDataset)) // throw new Exception("内部错误:FeatureClassCatalogItem构造参数必须为FeatueDataset"); //} public FeatureDatasetCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName, parent) { if (!(dsName is IFeatureDatasetName)) { throw new Exception("内部错误:FeatureClassCatalogItem构造参数必须为FeatueDataset"); } }
public WorkspaceCatalogItem(object objWorksapceConnction, enumWorkspaceType wsType, ICatalogItem parent,string strName) : base(null,parent) { this.m_WorkapcePropertySet = objWorksapceConnction; this.m_WorkspaceType = wsType; this.m_Caption = strName; }
public override void Click(enumContextKeys key) { switch (key) { case enumContextKeys.AddFeatureClass: using (frmFetClassDlg frm = new frmFetClassDlg()) { ICatalogEntity entity = new SpatialFeatureClass(); frm.SetSpatialDataset(_tag as SpatialFeatureDataset); (entity as CatalogEntityBase)._connString = (_tag as CatalogEntityBase)._connString; if (frm.ShowDialog(ref entity, true, false)) { if ((entity as SpatialFeatureClass).SpatialRef == null) { (entity as SpatialFeatureClass).SpatialRef = (_tag as SpatialFeatureDataset).SpatialRef; } entity.Store(); AddChild(new CatalogFeatureClass(entity.Name, entity, entity.Description)); } } Refresh(); break; case enumContextKeys.Property: using (frmFeatureDatasetsEditor frm = new frmFeatureDatasetsEditor()) { ICatalogEntity entity = _tag as ICatalogEntity; if (frm.ShowDialog(ref entity, false, false)) { entity.Store(); Refresh(); } } break; case enumContextKeys.Delete: if (MsgBox.ShowQuestionYesNo("确定要删除要素集\"" + _name + "\"吗?\n\n删除以后不能恢复。") == System.Windows.Forms.DialogResult.No) { return; } SpatialFeatureDataset ds = _tag as SpatialFeatureDataset; using (ICatalogEntityClass c = new CatalogEntityClassFeatureDataset(ds._connString)) { c.Delete(ds); ICatalogItem pIt = _parent; _parent.Remove(this); pIt.Refresh(); } break; case enumContextKeys.ImportData: ImportData(); break; default: base.Click(key); break; } }
public static IFeatureClassReader GetFeatureClassReader(ICatalogItem fetclassItem) { if (fetclassItem is CatalogFile) { return(GetFeatureClassReaderForFile(fetclassItem as CatalogFile)); } throw new NotSupportedException("数据源\"" + fetclassItem.Tag.ToString() + "\"的要素读取器未实现。"); }
//public TopologyCatalogItem(IDataset dsTopology, ICatalogItem parent) // : base(dsTopology, parent) //{ // if (!(dsTopology is ITopology)) // throw new Exception("内部错误:TopologyCatalogItem构造参数必须为Topology"); //} public TopologyCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName, parent) { if (!(dsName is ITopologyName)) { throw new Exception("内部错误:TopologyCatalogItem构造参数必须为Topology"); } }
public static IFetClassImporter GetImporter(ICatalogItem fetclassItem, ICatalogItem locationItem) { if (fetclassItem is CatalogFile && locationItem is CatalogLocal) { return(new ImporterByCopyFile()); } return(new ImporterByReaderWriter()); }
//public RasterSetCatalogItem(IDataset dsRaster, ICatalogItem parent) // : base(dsRaster, parent) //{ // if (!(dsRaster is IRasterDataset)) // throw new Exception("内部错误:RasterSetCatalogItem构造参数必须为Raster"); //} public RasterSetCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName, parent) { if (!(dsName is IRasterDatasetName)) { throw new Exception("内部错误:RasterSetCatalogItem构造参数必须为Raster"); } }
//public TableCatalogItem(IDataset dsTable, ICatalogItem parent) // : base(dsTable, parent) //{ // if(!(dsTable is ITable)) // throw new Exception("内部错误:TableCatalogItem构造参数必须为线性属性表"); //} public TableCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName, parent) { if (!(dsName is ITableName)) { throw new Exception("内部错误:TableCatalogItem构造参数必须为线性属性表"); } }
void it_Click(object sender, EventArgs e) { object[] objs = (sender as ToolStripMenuItem).Tag as object[]; ICatalogItem c = objs[1] as ICatalogItem; ContextOprItem opr = objs[0] as ContextOprItem; c.Click(opr.EnumKey); }
public static ICatalogItem CreateCatalog(IDatasetName dsNameSource,ICatalogItem parent,IWorkspaceCatalogItem workspaceItem) { if (dsNameSource == null) return null; if (dsNameSource is IWorkspaceName) { return new WorkspaceCatalogItem(dsNameSource, parent); } ICatalogItem catalogItem = null; switch (dsNameSource.Type) { case esriDatasetType.esriDTFeatureDataset: catalogItem = new FeatureDatasetCatalogItem(dsNameSource, parent); break; case esriDatasetType.esriDTFeatureClass: catalogItem = new FeatureClassCatalogItem(dsNameSource, parent); break; case esriDatasetType.esriDTTable: catalogItem = new TableCatalogItem(dsNameSource, parent); break; case esriDatasetType.esriDTTerrain: catalogItem = new TerrainCatalogItem(dsNameSource, parent); break; case esriDatasetType.esriDTTin: catalogItem = new TinCatalogItem(dsNameSource, parent); break; case esriDatasetType.esriDTTopology: catalogItem = new TopologyCatalogItem(dsNameSource, parent); break; case esriDatasetType.esriDTRasterCatalog: catalogItem = new RasterCatalogCatalogItem(dsNameSource, parent); break; case esriDatasetType.esriDTRasterDataset: case esriDatasetType.esriDTMosaicDataset: catalogItem= new RasterSetCatalogItem(dsNameSource, parent); break; case esriDatasetType.esriDTRasterBand: catalogItem= new RasterBandCatalogItem(dsNameSource, parent); break; default: return null; } if (catalogItem != null) catalogItem.WorkspaceItem = workspaceItem; return catalogItem; }
public static IFeatureClassWriter GetFetClassWriter(ICatalogItem locationItem) { if (locationItem is CatalogDatabaseConn || locationItem is CatalogFeatureDataset) { return(new FetClassWriterDb(locationItem)); } throw new NotSupportedException("类型为\"" + locationItem + "\"的位置暂不支持写。"); }
public void UpdateItem(ICatalogItem item) { if (this.ContainsItem(item)) { ICatalogItem oldItem = this.GetItem(item.ID); this.RemoveItem(oldItem); } this.AddItem(item); }
public void AddParameter(string parameterName, ICatalogItem item) { parameterName = parameterName.ToUpper(); if (this._parameters.ContainsKey(parameterName)) { this._parameters.Remove(parameterName); } this._parameters.Add(parameterName, item); }
public void Import(ICatalogItem fetClassItem, ICatalogItem locationItem, IProgressTracker tracker, string name, string displayName, string description) { CatalogFile cfile = fetClassItem as CatalogFile; CatalogLocal cloc = locationItem as CatalogLocal; string file = cfile.Tag.ToString(); string dstdir = cloc.Tag.ToString(); CopyFile(file, name, displayName, dstdir, tracker); }
/// <summary> /// /// 20131024华迪添加接口属性:分块编号[productArea] /// </summary> /// <param name="catalog"></param> /// <returns></returns> private string SaveToDb(ICatalogItem catalog) { MonitorProductInfo info = new MonitorProductInfo(); //fir ,fog info.productType = catalog.Info.GetPropertyValue("ProductIdentify"); //tjcp:统计产品 xxcp;信息列表 sgcp:栅格产品 ztcp:专题产品 slcp:矢量产品 dhcp:动画产品 info.productDataType = catalog.Info.GetPropertyValue("CatalogDef"); //VectorProduct、 info.productIdentify = catalog.Info.GetPropertyValue("SubProductIdentify"); //DBLV,0CSR,"PLST"; info.productIdentifyName = catalog.Info.GetPropertyValue("CatalogItemCN"); //"火点二值图"; info.satellite = catalog.Info.GetPropertyValue("Satellite"); info.sensor = catalog.Info.GetPropertyValue("Sensor"); info.subProductType = ""; //通常为空 info.orbitDateTime = DateTime.Parse(catalog.Info.GetPropertyValue("OrbitDateTime")); info.info = new Info(); info.info.orbitDateTime = info.orbitDateTime; info.info.satellite = info.satellite; info.info.sensor = info.sensor; info.productArea = catalog.Info.GetPropertyValue("Region"); if (string.IsNullOrWhiteSpace(info.productDataType)) { } string dir = _client.getDataDir(info); if (catalog.Info.Properties.ContainsKey(CatalogTreeView.ToDBInfoKey)) { catalog.Info.Properties[CatalogTreeView.ToDBInfoKey] = CatalogTreeView.ToDBInfoValue; } else { catalog.Info.Properties.Add(CatalogTreeView.ToDBInfoKey, CatalogTreeView.ToDBInfoValue); } string infoFilename = System.IO.Path.ChangeExtension(catalog.FileName, ".info"); catalog.Info.SaveTo(infoFilename); string[] extFiles = GetExtFiles(catalog.FileName); info.extendFiles = ExtFilesToString(extFiles); CopyFile(dir, catalog.FileName); if (extFiles != null && extFiles.Length != 0) { for (int i = 0; i < extFiles.Length; i++) { CopyFile(dir, extFiles[i]); } } string productFilename = System.IO.Path.GetFileName(catalog.FileName); info.productFileName = productFilename; info.productFilePath = dir; //SaveToDb(info.productIdentify, info); return(dir); }
public CatalogItemView(ICatalogItem item) { Id = item.Id; ParentId = item.Id; Name = item.Name; IsFolder = item.IsFolder; IsAR = item.IsAr; Price = item.Price; Preview = item.Preview; }
public void Import(ICatalogItem fetClassItem, ICatalogItem locationItem, IProgressTracker tracker, string name, string displayName, string description) { using (IFeatureClassReader fetcReader = FeatureClassReaderFactory.GetFeatureClassReader(fetClassItem)) { using (IFeatureClassWriter fetcWriter = FeatureClassWriterFactory.GetFetClassWriter(locationItem)) { fetcWriter.Write(fetcReader, tracker, name, displayName, description); } } }
public void AddItem(ICatalogItem worksapceItem) { if (m_Children == null) { m_Children = this.Childrens; } this.m_Children.Add(worksapceItem); SendOpenEvent(true); }
public bool DeleteItem(ICatalogItem itemTarget) { if (m_Children == null) return false; if (m_Children.Contains(itemTarget)) { m_Children.Remove(itemTarget); SendOpenEvent(true); return true; } return false; }
private void BandEvent(TreeListNode nodeTarget, ICatalogItem itemTarget) { itemTarget.OnOpen += delegate { ExpandNode(nodeTarget, true); }; itemTarget.OnRefresh += delegate { nodeTarget.Nodes.Clear(); if (itemTarget is IWorkspaceCatalogItem) { nodeTarget.ImageIndex = 0; } }; }
public override void OnClick() { if (m_UcCatalog != null && m_UcCatalog.Visible) { this.m_Hook.UIHook.CloseHookControl(m_Guid); } else { if (m_UcCatalog == null || m_HookControl == null || m_HookControl.IsDisposed) { m_UcCatalog = new UCCatalog(); m_UcCatalog.Init(m_Hook.Hook,base.SendMessage);// delegate(string strMsg) { base.SendMessage(strMsg); }); ESRI.ArcGIS.Controls.IHookHelper esriHookHelper = m_Hook.Hook as ESRI.ArcGIS.Controls.IHookHelper; IHooker hooker= new CatalogHooker(m_UcCatalog); (hooker.Hook as CatalogHookHelper).SelectedCatalogItemChanged += delegate(ICatalogItem cItem) { m_SelectedCatalogItem = cItem; m_CurrentLayer = null; if (m_SelectedCatalogItem == null) return; m_CurrentLayer = CatalogItemFactory.CreateLayer(m_SelectedCatalogItem); esriHookHelper.FocusMap.ClearLayers(); esriHookHelper.FocusMap.SpatialReference = null; if (m_CurrentLayer != null) { esriHookHelper.FocusMap.AddLayer(m_CurrentLayer); esriHookHelper.ActiveView.Extent = m_CurrentLayer.AreaOfInterest; esriHookHelper.ActiveView.Refresh(); } }; m_Guid=hooker.ID; base.m_Hook.UIHook.AddHooker(hooker, enumDockPosition.Left); } this.m_Hook.UIHook.ActiveHookControl(m_Guid); } }
//public WorkspaceCatalogItem(IDataset dsWorkspace,ICatalogItem parent):base(dsWorkspace,parent) //{ // if (!(dsWorkspace is IWorkspace)) // throw new Exception("内部错误:WorksapceCatalogItem 的构造参数必须为Workspace"); // this.m_Dataset = dsWorkspace; // m_Caption = this.m_Dataset.BrowseName ?? this.m_Dataset.Name; // IWorkspace wsSource=(dsWorkspace as IWorkspace); // m_WorkapcePropertySet = wsSource.ConnectionProperties; // m_WorkspaceType = (wsSource.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace ? enumWorkspaceType.SDE : // (wsSource.Type == esriWorkspaceType.esriFileSystemWorkspace ? enumWorkspaceType.File : enumWorkspaceType.Unknown)); //} public WorkspaceCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName, parent) { if (!(dsName is IWorkspaceName)) throw new Exception("内部错误:WorksapceCatalogItem 的构造参数必须为WorkspaceName"); //this.m_Dataset = (dsName as IName).Open() as IDataset; this.m_DatasetName = dsName; m_Caption = this.m_DatasetName.WorkspaceName.BrowseName ?? this.m_DatasetName.Name; IWorkspaceName wsSource = this.m_DatasetName.WorkspaceName; m_WorkapcePropertySet = wsSource.ConnectionProperties; //m_WorkspaceType = (wsSource.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace ? enumWorkspaceType.SDE : // (wsSource.Type == esriWorkspaceType.esriFileSystemWorkspace ? enumWorkspaceType.File : enumWorkspaceType.Unknown)); if (wsSource.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace) { m_WorkspaceType = enumWorkspaceType.SDE; } else if (wsSource.Type == esriWorkspaceType.esriFileSystemWorkspace) { m_WorkspaceType = enumWorkspaceType.File; } else { string strPath = wsSource.PathName; string strType = System.IO.Path.GetExtension(strPath); if (string.IsNullOrEmpty(strType)) m_WorkspaceType = enumWorkspaceType.Unknown; strType = strType.ToUpper(); if (strType == "MDB") m_WorkspaceType = enumWorkspaceType.PGDB; else if (strType == "GDB") m_WorkspaceType = enumWorkspaceType.FileGDB; else m_WorkspaceType = enumWorkspaceType.Unknown; } }
public File3DWorkspaceCatalogItem(ICatalogItem parent) : base(null, parent) { }
//public TopologyCatalogItem(IDataset dsTopology, ICatalogItem parent) // : base(dsTopology, parent) //{ // if (!(dsTopology is ITopology)) // throw new Exception("内部错误:TopologyCatalogItem构造参数必须为Topology"); //} public TopologyCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName, parent) { if (!(dsName is ITopologyName)) throw new Exception("内部错误:TopologyCatalogItem构造参数必须为Topology"); }
//public TerrainCatalogItem(IDataset dsTerrain, ICatalogItem parent) // : base(dsTerrain, parent) //{ //} public TerrainCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName, parent) { }
//public static bool Publish(double x, double y, double z, string modelFile, string shpFile) //{ // try // { // string strModelName = System.IO.Path.GetFileNameWithoutExtension(modelFile); // string strModelPath = System.IO.Path.GetDirectoryName(shpFile); // string xplPath = System.IO.Path.Combine(strModelPath, strModelName + ".Xpl2"); // if (!System.IO.File.Exists(xplPath)) // 有可能已经发布过了,目标xpl已经存在 // { // ProcessStartInfo processInfo = new ProcessStartInfo(); // //processInfo.FileName="%SkylineHome%\\MakeXpl.exe"; // processInfo.FileName = System.IO.Path.Combine(Environment.GetEnvironmentVariable("SkylineHome",EnvironmentVariableTarget.Machine), "MakeXpl.exe"); // processInfo.Arguments = string.Format("-inputFile {0} -outputDir {1} -Skipbadtextures", modelFile, strModelPath); // Process process = new Process(); // process.StartInfo = processInfo; // process.Start(); // process.WaitForExit(); // } // IWorkspace wsShp = Hy.Esri.Catalog.Utility.WorkspaceHelper.OpenWorkspace(Hy.Esri.Catalog.enumWorkspaceType.File, System.IO.Path.GetDirectoryName(shpFile)); // IFeatureClass fClass = (wsShp as IFeatureWorkspace).OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(shpFile)); // IFeature fModel = fClass.CreateFeature(); // IPoint pModel = fModel.Shape as IPoint; // pModel.X = x; // pModel.Y = y; // pModel.Z = z; // pModel.M = 0; // int modelNameIndex = fModel.Fields.FindField(Field_Name_3DRender_ModelName); // int modelPathIndex = fModel.Fields.FindField(Field_Name_3DRender_ModelPath); // if (modelNameIndex > -1) // fModel.set_Value(modelNameIndex, strModelName + ".Xpl2"); // if (modelPathIndex > -1) // fModel.set_Value(modelPathIndex, xplPath); // fModel.Store(); // // 生成相应的属性表 // string strSQL = string.Format("Insert into File3DAttribute(objectID) values({0})", fModel.OID); // m_Workspace.ExecuteSQL(strSQL); // System.Runtime.InteropServices.Marshal.ReleaseComObject(fModel); // System.Runtime.InteropServices.Marshal.ReleaseComObject(fClass); // System.Runtime.InteropServices.Marshal.ReleaseComObject(wsShp); // return true; // //return GlobalInit.DataHelper().ExecSQL(strSQL) > 0; // //return true; // } // catch (Exception exp) // { // ErrorMessage = exp.Message; // return false; // } //} //public static int GetNextObjectID() //{ // ITable tRegister = (m_Workspace as IFeatureWorkspace).OpenTable(Table_Name_Registerer); // IQueryFilter qFilter = new QueryFilterClass(); // qFilter.SubFields = Field_Name_ObjectID; // qFilter.WhereClause = "ObjectID=(Select Max(ObjectID) from File3DRegister)"; // ICursor cursor = tRegister.Search(qFilter, false); // IRow row = cursor.NextRow(); // if (row != null) // return Convert.ToInt32(row.get_Value(0)) + 1; // return 1; // //return Convert.ToInt32(GlobalInit.DataHelper().ExecSQLScalar("select nvl(max(ObjectID),0)+1 from File3DRegister")); //} //public static bool SaveAndRegister3DFile(string str3DFile, string featureClass, int featureID) //{ // CreateRegisterTable(); // string str3DName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(str3DFile); // string str3DPath=Environment.GetEnvironmentVariable("ModelShareFolder",System.EnvironmentVariableTarget.Machine); // //string str3DPath = Properties.Settings.Default.ModelShareFolder; // try // { // string strTarget = System.IO.Path.Combine(str3DPath, str3DName); // System.IO.File.Copy(str3DFile, strTarget); // // Register // int newOID = GetNextObjectID(); // string strSQL = string.Format("Insert into File3DRegister(DataID,ObjectID,DataLink) values('{0}',{1},'{2}')", GetDataID(featureClass, featureID).Replace("'", "''"), newOID, strTarget); // //if (GlobalInit.DataHelper().ExecSQL(strSQL) < 1) // // return false; // m_Workspace.ExecuteSQL(strSQL); // //strSQL = string.Format("Insert into File3DAttribute(objectID) values({0})", newOID); // ////return GlobalInit.DataHelper().ExecSQL(strSQL) > 0; // //m_Workspace.ExecuteSQL(strSQL); // return true; // } // catch (Exception exp) // { // ErrorMessage = exp.Message; // return false; // } //} //public static bool Import3DFileEx(string str3DFile, IWorkspace wsTarget, string featrueDatasetName, string featureClassName, string strSpatialRef, ref IFeature feature3D) //{ // if (!Hy.Esri.Catalog.Utility.GpTool.Import3DFile(str3DFile, wsTarget, featrueDatasetName, featureClassName, strSpatialRef, ref feature3D)) // { // ErrorMessage = Hy.Esri.Catalog.Utility.GpTool.ErrorMessage; // return false; // } // //string strClassName = System.IO.Path.GetFileNameWithoutExtension(outPut); // //int featureID = 1; // 除shp外,新建的FeatureClass第一条记录OID为1 // string strClassName = (feature3D.Class as IDataset).Name; // 原因是:当存入SDE后,Dataset的名字将在前面加上“数据库名.用户名.” // return SaveAndRegister3DFile(str3DFile, strClassName, feature3D.OID); //} ///// <summary> ///// ///// </summary> ///// <param name="str3DFile"></param> ///// <param name="wsOut">指导入到的Workspace</param> ///// <param name="outPut">指导入到的目标全路径(GPstring)</param> ///// <param name="strSpatialRef"></param> ///// <returns></returns> //public static bool Append3DFileEx(string str3DFile, IFeatureClass fClassTarget, string strSpatialRef, ref IFeature feature3D) //{ // if (!Hy.Esri.Catalog.Utility.GpTool.Append3DFile(str3DFile, fClassTarget, strSpatialRef, ref feature3D)) // { // ErrorMessage = Hy.Esri.Catalog.Utility.GpTool.ErrorMessage; // return false; // } // return SaveAndRegister3DFile(str3DFile, (fClassTarget as IDataset).Name, feature3D.OID); //} public static int GetCatalogImageIndex(ICatalogItem item) { //SDE //Local //FDs //FC3D //FCPoint //FCLine //FCArea //FCAnno //FCEmpty //RasterCatalog //RtasterSet //NestRaster //table //Terrain //Tin //Topo if (item == null) return 8; switch (item.Type) { case enumCatalogType.Workpace: return 0; case enumCatalogType.Undefine: return -1; case enumCatalogType.Topology: return 16; case enumCatalogType.Tin: return 15; case enumCatalogType.Terrain: return 14; case enumCatalogType.Table: return 13; case enumCatalogType.RasterMosaic: return 12; case enumCatalogType.RasterBand: return 11; case enumCatalogType.RasterSet: return 10; case enumCatalogType.RasterCatalog: return 9; case enumCatalogType.FeatureDataset: return 2; case enumCatalogType.FeatureClass3D: return 3; case enumCatalogType.FeatureClassPoint: return 4; case enumCatalogType.FeatureClassLine: return 5; case enumCatalogType.FeatureClassArea: return 6; case enumCatalogType.FeatureClassAnnotation: return 7; case enumCatalogType.FeatureClassEmpty: return 8; case enumCatalogType.ThreeDimenModel: return 19; } return -1; }
public static ILayer CreateLayer(ICatalogItem catalogItem) { if (catalogItem == null || catalogItem.Dataset==null) return null; ILayer lyrNew = null; enumCatalogType catalogType = catalogItem.Type; switch(catalogType) { case enumCatalogType.Workpace: case enumCatalogType.FeatureDataset: case enumCatalogType.Table: return null; case enumCatalogType.FeatureClassPoint: case enumCatalogType.FeatureClassLine: case enumCatalogType.FeatureClassArea: case enumCatalogType.FeatureClassAnnotation: case enumCatalogType.FeatureClassEmpty: case enumCatalogType.FeatureClass3D: case enumCatalogType.RasterCatalog: IFeatureLayer lyrFeature= new FeatureLayerClass(); lyrFeature.FeatureClass = catalogItem.Dataset as IFeatureClass; lyrNew = lyrFeature; break; case enumCatalogType.RasterMosaic: case enumCatalogType.RasterSet: IRasterLayer lyrRaster = new RasterLayerClass(); lyrRaster.CreateFromDataset(catalogItem.Dataset as IRasterDataset); lyrNew = lyrRaster; break; case enumCatalogType.RasterBand: IRasterLayer lyrRasterBand = new RasterLayerClass(); IRasterBand rasterBand = catalogItem.Dataset as IRasterBand; IRasterBandCollection colRasterBand = new RasterClass(); colRasterBand.Add(rasterBand, 0); lyrRasterBand.CreateFromRaster(colRasterBand as IRaster); lyrNew = lyrRasterBand; break; case enumCatalogType.Tin: ITinLayer lyrTin = new TinLayerClass(); lyrTin.Dataset = catalogItem.Dataset as ITin; lyrNew = lyrTin; break; case enumCatalogType.Terrain: ITerrainLayer lyrTerrain = new TerrainLayerClass(); lyrTerrain.Terrain = catalogItem.Dataset as ITerrain; lyrNew = lyrTerrain; break; case enumCatalogType.Topology: ITopologyLayer lyrTopology = new TopologyLayerClass(); lyrTopology.Topology = catalogItem.Dataset as ITopology; lyrNew = lyrTopology as ILayer; break; } return lyrNew; }
//public FeatureDatasetCatalogItem(IDataset dsFeatureDataset, ICatalogItem parent):base(dsFeatureDataset,parent) //{ // if (!(dsFeatureDataset is IFeatureDataset)) // throw new Exception("内部错误:FeatureClassCatalogItem构造参数必须为FeatueDataset"); //} public FeatureDatasetCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName,parent) { if (!(dsName is IFeatureDatasetName)) throw new Exception("内部错误:FeatureClassCatalogItem构造参数必须为FeatueDataset"); }
//public ThreeDimenModelCatalogItem(IDataset dsFeatureClass, int featureOID, ICatalogItem parent) // : base(dsFeatureClass, parent) //{ // m_FeatureOID = featureOID; //} public ThreeDimenModelCatalogItem(IDatasetName dsName, int featureOID, ICatalogItem parent) : base(dsName, parent) { m_FeatureOID = featureOID; }
//public RasterSetCatalogItem(IDataset dsRaster, ICatalogItem parent) // : base(dsRaster, parent) //{ // if (!(dsRaster is IRasterDataset)) // throw new Exception("内部错误:RasterSetCatalogItem构造参数必须为Raster"); //} public RasterSetCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName, parent) { if (!(dsName is IRasterDatasetName)) throw new Exception("内部错误:RasterSetCatalogItem构造参数必须为Raster"); }
//public TableCatalogItem(IDataset dsTable, ICatalogItem parent) // : base(dsTable, parent) //{ // if(!(dsTable is ITable)) // throw new Exception("内部错误:TableCatalogItem构造参数必须为线性属性表"); //} public TableCatalogItem(IDatasetName dsName, ICatalogItem parent) : base(dsName, parent) { if(!(dsName is ITableName)) throw new Exception("内部错误:TableCatalogItem构造参数必须为线性属性表"); }
//protected CatalogItem(IDataset ds, ICatalogItem parent) //{ // this.m_Dataset = ds; // this.m_Parent = parent; // this.m_Type = GetCatalogType(); //} protected CatalogItem(IDatasetName dsName, ICatalogItem parent) { this.m_DatasetName = dsName; this.m_Parent = parent; this.m_Type = GetCatalogType(dsName); }