public static void ExportMultipleToOGR(frmMain pFrm, string[] pInputFilenames, string pOutputFilename) { pFrm.Log("Starting to process selected files..."); foreach (var mDbFilename in pInputFilenames) { var mDb = new Database(mDbFilename); var mAddressUnitFeatures = new AddressUnitFeature(mDb); var mStreetNameFeatures = new StreetNameSignFeature(mDb); var mAddressGuideFeatures = new AddressGuideSignFeature(mDb); mAddressUnitFeatures.PopulateFromTable(); mStreetNameFeatures.PopulateFromTable(); mAddressGuideFeatures.PopulateFromTable(); var mGroup = new MapGroup(); mGroup.LegendText = mDb.DbBaseName; IFeatureLayer mAUNSLayer = (IFeatureLayer)ExtFunctions.GetFeatureLayer( mGroup.Layers, mAddressUnitFeatures, LayerNames.AddressUnitSigns, MapSymbols.PointSymbol(SignColors.AddressUnitSign, 3), ExtFunctions.GetProjByEPSG(32640) ); var mAUNSResult = ExtFunctions.ExportFeatureLayerToOGR( pDrvNm: "FileGDB", pFLyr: mAUNSLayer, pOPFn: pOutputFilename, pSrcProj: ExtFunctions.GetProjByEPSG(32640), pTgtProj: ExtFunctions.GetProjByEPSG(32640), pLCOpts: new List <string>() { "FEATURE_DATASET=Simplified" }, pAppend: true ); pFrm.Log(mAUNSResult.GetMessages()); IFeatureLayer mSNSLayer = (IFeatureLayer)ExtFunctions.GetFeatureLayer( mGroup.Layers, mStreetNameFeatures, LayerNames.StreetNameSigns, MapSymbols.PointSymbol(SignColors.StreetNameSign, 3), ExtFunctions.GetProjByEPSG(32640) ); var mSNSResult = ExtFunctions.ExportFeatureLayerToOGR( pDrvNm: "FileGDB", pFLyr: mSNSLayer, pOPFn: pOutputFilename, pSrcProj: ExtFunctions.GetProjByEPSG(32640), pTgtProj: ExtFunctions.GetProjByEPSG(32640), pLCOpts: new List <string>() { "FEATURE_DATASET=Simplified" }, pAppend: true ); pFrm.Log(mSNSResult.GetMessages()); IFeatureLayer mAGSLayer = (IFeatureLayer)ExtFunctions.GetFeatureLayer( mGroup.Layers, mAddressGuideFeatures, LayerNames.AddressGuideSigns, MapSymbols.PointSymbol(SignColors.AddressGuideSign, 3), ExtFunctions.GetProjByEPSG(32640) ); var mAGSResult = ExtFunctions.ExportFeatureLayerToOGR( pDrvNm: "FileGDB", pFLyr: mAGSLayer, pOPFn: pOutputFilename, pSrcProj: ExtFunctions.GetProjByEPSG(32640), pTgtProj: ExtFunctions.GetProjByEPSG(32640), pLCOpts: new List <string>() { "FEATURE_DATASET=Simplified" }, pAppend: true ); pFrm.Log(mAGSResult.GetMessages()); pFrm.Log("Completed parsing: " + mDbFilename); Application.DoEvents(); } pFrm.Log("Wrote output to file: " + pOutputFilename); }
public static void ParseSelectedDatabase(Map pMap, ProjectionInfo pProjection) { if (frmMain.dbx != null) { var mGroup = new MapGroup(); mGroup.LegendText = frmMain.dbx.DbBaseName; Debug.WriteLine("Got here"); var mAddressUnitFeatures = new AddressUnitFeature(frmMain.dbx); mAddressUnitFeatures.PopulateFromTable(); var mAddressUnitLayer = ExtFunctions.GetFeatureLayer(mGroup.Layers, mAddressUnitFeatures, LayerNames.AddressUnitSigns, MapSymbols.PointSymbol(SignColors.AddressUnitSign, 3), pProjection); mAddressUnitLayer.Reproject(pMap.Projection); ExtFunctions.AddLabelsForFeatureLayer(mAddressUnitLayer, LayerNames.AddressUnitSigns, "[ADDRESSUNITNR] ([ROADID])", Color.White, "Arial", 10, true); var mStreetNameSignFeatures = new StreetNameSignFeature(frmMain.dbx); mStreetNameSignFeatures.PopulateFromTable(); var mStreetSignLayer = ExtFunctions.GetFeatureLayer(mGroup.Layers, mStreetNameSignFeatures, LayerNames.StreetNameSigns, MapSymbols.PointSymbol(SignColors.StreetNameSign, 6), pProjection); mStreetSignLayer.Reproject(pMap.Projection); var mAddressGuideSignFeatures = new AddressGuideSignFeature(frmMain.dbx); mAddressGuideSignFeatures.PopulateFromTable(); var mAddressGuideSignLayer = ExtFunctions.GetFeatureLayer(mGroup.Layers, mAddressGuideSignFeatures, LayerNames.AddressGuideSigns, MapSymbols.PointSymbol(SignColors.AddressGuideSign, 4), pProjection); mAddressGuideSignLayer.Reproject(pMap.Projection); pMap.Layers.Add(mGroup); mStreetSignLayer.SelectionEnabled = false; mAddressGuideSignLayer.SelectionEnabled = false; mAddressUnitLayer.SelectionEnabled = false; frmMain.dbx.Close(); Extent mExtent = new Extent(); ExtFunctions.CombineExtents(ref mExtent, mStreetSignLayer.Extent); ExtFunctions.CombineExtents(ref mExtent, mAddressGuideSignLayer.Extent); ExtFunctions.CombineExtents(ref mExtent, mAddressUnitLayer.Extent); if (mExtent.Width != 0 && mExtent.Height != 0) { pMap.ViewExtents = mExtent; pMap.Invalidate(); } } }
public static void ExportMultipleToMyAbuDhabiNet(frmMain pFrm, string[] pInputFilenames, string pOutputFilename) { // Overwrite first entry bool pAppend = false; pFrm.Log("Starting to process selected files..."); foreach (var mDbFilename in pInputFilenames) { var mDb = new Database(mDbFilename); var mGroup = new MapGroup(); mGroup.LegendText = mDb.DbBaseName; var mAddressUnitFeatures = new AddressUnitFeature(mDb); mAddressUnitFeatures.PopulateFromTable(); pFrm.Log("Number of address unit features in source: " + mAddressUnitFeatures.NumRows()); IPointLayer mAddressUnitLayer = (IPointLayer)ExtFunctions.GetFeatureLayer(mGroup.Layers, mAddressUnitFeatures, LayerNames.AddressUnitSigns, MapSymbols.PointSymbol(SignColors.AddressUnitSign, 3), ExtFunctions.GetProjByEPSG(32640)); var mAddressUnitResult = ExtFunctions.ExportToMyAbuDhabiNet(pOutputFilename, mAddressUnitLayer, ExtFunctions.GetProjByEPSG(4326), ExtFunctions.GetProjByEPSG(4326), pAppend, SignType.addressUnitNumberSign); pFrm.Log(mAddressUnitResult.GetMessages()); //After first file-write, set append to true pAppend = true; var mSnsFeatures = new StreetNameSignFeature(mDb); mSnsFeatures.PopulateFromTable(); pFrm.Log("Number of street name sign features in source: " + mSnsFeatures.NumRows()); IPointLayer mSnsLayer = (IPointLayer)ExtFunctions.GetFeatureLayer(mGroup.Layers, mSnsFeatures, LayerNames.StreetNameSigns, MapSymbols.PointSymbol(SignColors.StreetNameSign, 3), ExtFunctions.GetProjByEPSG(32640)); var mSnsResult = ExtFunctions.ExportToMyAbuDhabiNet(pOutputFilename, mSnsLayer, ExtFunctions.GetProjByEPSG(4326), ExtFunctions.GetProjByEPSG(4326), true, SignType.streetNameSign); pFrm.Log(mSnsResult.GetMessages()); var mAgsFeatures = new AddressGuideSignFeature(mDb); mAgsFeatures.PopulateFromTable(); pFrm.Log("Number of address guide sign features in source: " + mAgsFeatures.NumRows()); IPointLayer mAgsLayer = (IPointLayer)ExtFunctions.GetFeatureLayer(mGroup.Layers, mAgsFeatures, LayerNames.AddressGuideSigns, MapSymbols.PointSymbol(SignColors.AddressGuideSign, 3), ExtFunctions.GetProjByEPSG(32640)); var mAgsResult = ExtFunctions.ExportToMyAbuDhabiNet(pOutputFilename, mAgsLayer, ExtFunctions.GetProjByEPSG(4326), ExtFunctions.GetProjByEPSG(4326), true, SignType.addressGuideSign); pFrm.Log(mAgsResult.GetMessages()); pFrm.Log("Completed parsing: " + mDbFilename); Application.DoEvents(); } pFrm.Log("Wrote output to file: " + pOutputFilename); }