diff --git a/ClassExpCad.cs b/ClassExpCad.cs new file mode 100644 index 0000000..f914c57 --- /dev/null +++ b/ClassExpCad.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.IO; +using System.Windows.Forms; +using DXFLibrary; +using System.Drawing; + +namespace Cyberpipe +{ + class ClassExpCad + { + public static void ExpDxfFromLayers(GSOFeatures features,string saveFilePath) + { + Dictionary layerNameAndColor=new Dictionary(); + for (int i = 0;i < features.Length;i++) + { + if (!layerNameAndColor.Keys.Contains(features[i].Dataset.Caption)) + layerNameAndColor.Add(features[i].Dataset.Caption, getShortColorFromFeature(features[i])); + } + + expGSOLayerToDxf(layerNameAndColor, features, saveFilePath); + } + + private static void expGSOLayerToDxf(Dictionary layerNameAndColor, + GSOFeatures features, string saveFilePath) + { + DXFLibrary.Document doc = new DXFLibrary.Document(); + DXFLibrary.Tables tables = new DXFLibrary.Tables(); + doc.SetTables(tables); + DXFLibrary.Table layers = new DXFLibrary.Table("LAYER"); + tables.addTable(layers); + + DXFLibrary.Layer layerDoors; + foreach (var layerName in layerNameAndColor) + { + layerDoors = new DXFLibrary.Layer(layerName.Key, layerName.Value, "CONTINUOUS"); + layers.AddTableEntry(layerDoors); + } + + for (int i = 0; i < features.Length; i++) + { + GSOGeoPolyline3D polyLine = features[i].Geometry as GSOGeoPolyline3D; + GSOPoint3d startPt = polyLine[0][0]; + GSOPoint3d endPt = polyLine[0][1]; + + DXFLibrary.Line line = new DXFLibrary.Line(features[i].Dataset.Caption, startPt.X, startPt.Y, endPt.X, endPt.Y); + doc.add(line); + } + + /* + DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + doc.add(cc); + */ + /* + DXFLibrary.Line line2 = new DXFLibrary.Line("Doors", 0, 0, 10, 0); + doc.add(line2); + DXFLibrary.Line line3 = new DXFLibrary.Line("Doors", 10, 10, 0, 10); + doc.add(line3); + DXFLibrary.Line line4 = new DXFLibrary.Line("Doors", 10, 10, 10, 0); + doc.add(line4); + DXFLibrary.Line3D line5 = new DXFLibrary.Line3D("Doors", 2, 2, 0, 5, 5, 10); + doc.add(line5); + + //DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + //doc.add(cc); + */ + + FileStream fs = new FileStream(saveFilePath, System.IO.FileMode.Create); + DXFLibrary.Writer.Write(doc, fs); + fs.Close(); + } + + private static short getShortColorFromFeature(GSOFeature feature) + { + + short color = 30; + /* + GSOGeoPolyline3D polyLine = feature.Geometry as GSOGeoPolyline3D; + GSOPipeLineStyle3D line = GSOPipeLineStyle3D polyLine; + GSOExtendSectionLineStyle3D style1 = GSOExtendSectionLineStyle3D polyLine; + * * */ + return color; + + } + + } +} diff --git a/ClassExpCad.cs b/ClassExpCad.cs new file mode 100644 index 0000000..f914c57 --- /dev/null +++ b/ClassExpCad.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.IO; +using System.Windows.Forms; +using DXFLibrary; +using System.Drawing; + +namespace Cyberpipe +{ + class ClassExpCad + { + public static void ExpDxfFromLayers(GSOFeatures features,string saveFilePath) + { + Dictionary layerNameAndColor=new Dictionary(); + for (int i = 0;i < features.Length;i++) + { + if (!layerNameAndColor.Keys.Contains(features[i].Dataset.Caption)) + layerNameAndColor.Add(features[i].Dataset.Caption, getShortColorFromFeature(features[i])); + } + + expGSOLayerToDxf(layerNameAndColor, features, saveFilePath); + } + + private static void expGSOLayerToDxf(Dictionary layerNameAndColor, + GSOFeatures features, string saveFilePath) + { + DXFLibrary.Document doc = new DXFLibrary.Document(); + DXFLibrary.Tables tables = new DXFLibrary.Tables(); + doc.SetTables(tables); + DXFLibrary.Table layers = new DXFLibrary.Table("LAYER"); + tables.addTable(layers); + + DXFLibrary.Layer layerDoors; + foreach (var layerName in layerNameAndColor) + { + layerDoors = new DXFLibrary.Layer(layerName.Key, layerName.Value, "CONTINUOUS"); + layers.AddTableEntry(layerDoors); + } + + for (int i = 0; i < features.Length; i++) + { + GSOGeoPolyline3D polyLine = features[i].Geometry as GSOGeoPolyline3D; + GSOPoint3d startPt = polyLine[0][0]; + GSOPoint3d endPt = polyLine[0][1]; + + DXFLibrary.Line line = new DXFLibrary.Line(features[i].Dataset.Caption, startPt.X, startPt.Y, endPt.X, endPt.Y); + doc.add(line); + } + + /* + DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + doc.add(cc); + */ + /* + DXFLibrary.Line line2 = new DXFLibrary.Line("Doors", 0, 0, 10, 0); + doc.add(line2); + DXFLibrary.Line line3 = new DXFLibrary.Line("Doors", 10, 10, 0, 10); + doc.add(line3); + DXFLibrary.Line line4 = new DXFLibrary.Line("Doors", 10, 10, 10, 0); + doc.add(line4); + DXFLibrary.Line3D line5 = new DXFLibrary.Line3D("Doors", 2, 2, 0, 5, 5, 10); + doc.add(line5); + + //DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + //doc.add(cc); + */ + + FileStream fs = new FileStream(saveFilePath, System.IO.FileMode.Create); + DXFLibrary.Writer.Write(doc, fs); + fs.Close(); + } + + private static short getShortColorFromFeature(GSOFeature feature) + { + + short color = 30; + /* + GSOGeoPolyline3D polyLine = feature.Geometry as GSOGeoPolyline3D; + GSOPipeLineStyle3D line = GSOPipeLineStyle3D polyLine; + GSOExtendSectionLineStyle3D style1 = GSOExtendSectionLineStyle3D polyLine; + * * */ + return color; + + } + + } +} diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index 9dabf90..b3a557e 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -123,6 +123,10 @@ False bin\x86\Debug\DevComponents.Instrumentation.dll + + False + bin\x86\Debug\DXFLibrary.dll + False bin\x86\Debug\GSBalloonExDotNet.dll @@ -207,6 +211,7 @@ + diff --git a/ClassExpCad.cs b/ClassExpCad.cs new file mode 100644 index 0000000..f914c57 --- /dev/null +++ b/ClassExpCad.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.IO; +using System.Windows.Forms; +using DXFLibrary; +using System.Drawing; + +namespace Cyberpipe +{ + class ClassExpCad + { + public static void ExpDxfFromLayers(GSOFeatures features,string saveFilePath) + { + Dictionary layerNameAndColor=new Dictionary(); + for (int i = 0;i < features.Length;i++) + { + if (!layerNameAndColor.Keys.Contains(features[i].Dataset.Caption)) + layerNameAndColor.Add(features[i].Dataset.Caption, getShortColorFromFeature(features[i])); + } + + expGSOLayerToDxf(layerNameAndColor, features, saveFilePath); + } + + private static void expGSOLayerToDxf(Dictionary layerNameAndColor, + GSOFeatures features, string saveFilePath) + { + DXFLibrary.Document doc = new DXFLibrary.Document(); + DXFLibrary.Tables tables = new DXFLibrary.Tables(); + doc.SetTables(tables); + DXFLibrary.Table layers = new DXFLibrary.Table("LAYER"); + tables.addTable(layers); + + DXFLibrary.Layer layerDoors; + foreach (var layerName in layerNameAndColor) + { + layerDoors = new DXFLibrary.Layer(layerName.Key, layerName.Value, "CONTINUOUS"); + layers.AddTableEntry(layerDoors); + } + + for (int i = 0; i < features.Length; i++) + { + GSOGeoPolyline3D polyLine = features[i].Geometry as GSOGeoPolyline3D; + GSOPoint3d startPt = polyLine[0][0]; + GSOPoint3d endPt = polyLine[0][1]; + + DXFLibrary.Line line = new DXFLibrary.Line(features[i].Dataset.Caption, startPt.X, startPt.Y, endPt.X, endPt.Y); + doc.add(line); + } + + /* + DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + doc.add(cc); + */ + /* + DXFLibrary.Line line2 = new DXFLibrary.Line("Doors", 0, 0, 10, 0); + doc.add(line2); + DXFLibrary.Line line3 = new DXFLibrary.Line("Doors", 10, 10, 0, 10); + doc.add(line3); + DXFLibrary.Line line4 = new DXFLibrary.Line("Doors", 10, 10, 10, 0); + doc.add(line4); + DXFLibrary.Line3D line5 = new DXFLibrary.Line3D("Doors", 2, 2, 0, 5, 5, 10); + doc.add(line5); + + //DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + //doc.add(cc); + */ + + FileStream fs = new FileStream(saveFilePath, System.IO.FileMode.Create); + DXFLibrary.Writer.Write(doc, fs); + fs.Close(); + } + + private static short getShortColorFromFeature(GSOFeature feature) + { + + short color = 30; + /* + GSOGeoPolyline3D polyLine = feature.Geometry as GSOGeoPolyline3D; + GSOPipeLineStyle3D line = GSOPipeLineStyle3D polyLine; + GSOExtendSectionLineStyle3D style1 = GSOExtendSectionLineStyle3D polyLine; + * * */ + return color; + + } + + } +} diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index 9dabf90..b3a557e 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -123,6 +123,10 @@ False bin\x86\Debug\DevComponents.Instrumentation.dll + + False + bin\x86\Debug\DXFLibrary.dll + False bin\x86\Debug\GSBalloonExDotNet.dll @@ -207,6 +211,7 @@ + diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3264c0b..24e3e41 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/ClassExpCad.cs b/ClassExpCad.cs new file mode 100644 index 0000000..f914c57 --- /dev/null +++ b/ClassExpCad.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.IO; +using System.Windows.Forms; +using DXFLibrary; +using System.Drawing; + +namespace Cyberpipe +{ + class ClassExpCad + { + public static void ExpDxfFromLayers(GSOFeatures features,string saveFilePath) + { + Dictionary layerNameAndColor=new Dictionary(); + for (int i = 0;i < features.Length;i++) + { + if (!layerNameAndColor.Keys.Contains(features[i].Dataset.Caption)) + layerNameAndColor.Add(features[i].Dataset.Caption, getShortColorFromFeature(features[i])); + } + + expGSOLayerToDxf(layerNameAndColor, features, saveFilePath); + } + + private static void expGSOLayerToDxf(Dictionary layerNameAndColor, + GSOFeatures features, string saveFilePath) + { + DXFLibrary.Document doc = new DXFLibrary.Document(); + DXFLibrary.Tables tables = new DXFLibrary.Tables(); + doc.SetTables(tables); + DXFLibrary.Table layers = new DXFLibrary.Table("LAYER"); + tables.addTable(layers); + + DXFLibrary.Layer layerDoors; + foreach (var layerName in layerNameAndColor) + { + layerDoors = new DXFLibrary.Layer(layerName.Key, layerName.Value, "CONTINUOUS"); + layers.AddTableEntry(layerDoors); + } + + for (int i = 0; i < features.Length; i++) + { + GSOGeoPolyline3D polyLine = features[i].Geometry as GSOGeoPolyline3D; + GSOPoint3d startPt = polyLine[0][0]; + GSOPoint3d endPt = polyLine[0][1]; + + DXFLibrary.Line line = new DXFLibrary.Line(features[i].Dataset.Caption, startPt.X, startPt.Y, endPt.X, endPt.Y); + doc.add(line); + } + + /* + DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + doc.add(cc); + */ + /* + DXFLibrary.Line line2 = new DXFLibrary.Line("Doors", 0, 0, 10, 0); + doc.add(line2); + DXFLibrary.Line line3 = new DXFLibrary.Line("Doors", 10, 10, 0, 10); + doc.add(line3); + DXFLibrary.Line line4 = new DXFLibrary.Line("Doors", 10, 10, 10, 0); + doc.add(line4); + DXFLibrary.Line3D line5 = new DXFLibrary.Line3D("Doors", 2, 2, 0, 5, 5, 10); + doc.add(line5); + + //DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + //doc.add(cc); + */ + + FileStream fs = new FileStream(saveFilePath, System.IO.FileMode.Create); + DXFLibrary.Writer.Write(doc, fs); + fs.Close(); + } + + private static short getShortColorFromFeature(GSOFeature feature) + { + + short color = 30; + /* + GSOGeoPolyline3D polyLine = feature.Geometry as GSOGeoPolyline3D; + GSOPipeLineStyle3D line = GSOPipeLineStyle3D polyLine; + GSOExtendSectionLineStyle3D style1 = GSOExtendSectionLineStyle3D polyLine; + * * */ + return color; + + } + + } +} diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index 9dabf90..b3a557e 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -123,6 +123,10 @@ False bin\x86\Debug\DevComponents.Instrumentation.dll + + False + bin\x86\Debug\DXFLibrary.dll + False bin\x86\Debug\GSBalloonExDotNet.dll @@ -207,6 +211,7 @@ + diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3264c0b..24e3e41 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/MainFrm.cs b/MainFrm.cs index af50d21..5d18e03 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -2145,7 +2145,6 @@ dataGridViewX4.Rows[idx].Cells[0].Value = resLayer.Caption; var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; dataGridViewX4.Rows[idx].Cells[1].Value = featureName; - } } return; diff --git a/ClassExpCad.cs b/ClassExpCad.cs new file mode 100644 index 0000000..f914c57 --- /dev/null +++ b/ClassExpCad.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.IO; +using System.Windows.Forms; +using DXFLibrary; +using System.Drawing; + +namespace Cyberpipe +{ + class ClassExpCad + { + public static void ExpDxfFromLayers(GSOFeatures features,string saveFilePath) + { + Dictionary layerNameAndColor=new Dictionary(); + for (int i = 0;i < features.Length;i++) + { + if (!layerNameAndColor.Keys.Contains(features[i].Dataset.Caption)) + layerNameAndColor.Add(features[i].Dataset.Caption, getShortColorFromFeature(features[i])); + } + + expGSOLayerToDxf(layerNameAndColor, features, saveFilePath); + } + + private static void expGSOLayerToDxf(Dictionary layerNameAndColor, + GSOFeatures features, string saveFilePath) + { + DXFLibrary.Document doc = new DXFLibrary.Document(); + DXFLibrary.Tables tables = new DXFLibrary.Tables(); + doc.SetTables(tables); + DXFLibrary.Table layers = new DXFLibrary.Table("LAYER"); + tables.addTable(layers); + + DXFLibrary.Layer layerDoors; + foreach (var layerName in layerNameAndColor) + { + layerDoors = new DXFLibrary.Layer(layerName.Key, layerName.Value, "CONTINUOUS"); + layers.AddTableEntry(layerDoors); + } + + for (int i = 0; i < features.Length; i++) + { + GSOGeoPolyline3D polyLine = features[i].Geometry as GSOGeoPolyline3D; + GSOPoint3d startPt = polyLine[0][0]; + GSOPoint3d endPt = polyLine[0][1]; + + DXFLibrary.Line line = new DXFLibrary.Line(features[i].Dataset.Caption, startPt.X, startPt.Y, endPt.X, endPt.Y); + doc.add(line); + } + + /* + DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + doc.add(cc); + */ + /* + DXFLibrary.Line line2 = new DXFLibrary.Line("Doors", 0, 0, 10, 0); + doc.add(line2); + DXFLibrary.Line line3 = new DXFLibrary.Line("Doors", 10, 10, 0, 10); + doc.add(line3); + DXFLibrary.Line line4 = new DXFLibrary.Line("Doors", 10, 10, 10, 0); + doc.add(line4); + DXFLibrary.Line3D line5 = new DXFLibrary.Line3D("Doors", 2, 2, 0, 5, 5, 10); + doc.add(line5); + + //DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + //doc.add(cc); + */ + + FileStream fs = new FileStream(saveFilePath, System.IO.FileMode.Create); + DXFLibrary.Writer.Write(doc, fs); + fs.Close(); + } + + private static short getShortColorFromFeature(GSOFeature feature) + { + + short color = 30; + /* + GSOGeoPolyline3D polyLine = feature.Geometry as GSOGeoPolyline3D; + GSOPipeLineStyle3D line = GSOPipeLineStyle3D polyLine; + GSOExtendSectionLineStyle3D style1 = GSOExtendSectionLineStyle3D polyLine; + * * */ + return color; + + } + + } +} diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index 9dabf90..b3a557e 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -123,6 +123,10 @@ False bin\x86\Debug\DevComponents.Instrumentation.dll + + False + bin\x86\Debug\DXFLibrary.dll + False bin\x86\Debug\GSBalloonExDotNet.dll @@ -207,6 +211,7 @@ + diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3264c0b..24e3e41 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/MainFrm.cs b/MainFrm.cs index af50d21..5d18e03 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -2145,7 +2145,6 @@ dataGridViewX4.Rows[idx].Cells[0].Value = resLayer.Caption; var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; dataGridViewX4.Rows[idx].Cells[1].Value = featureName; - } } return; diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index 3bcedcf..39b4d34 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -4473,7 +4473,7 @@ this.dataGridViewX2.ReadOnly = true; this.dataGridViewX2.RowHeadersVisible = false; this.dataGridViewX2.RowTemplate.Height = 23; - this.dataGridViewX2.Size = new System.Drawing.Size(35536, 92); + this.dataGridViewX2.Size = new System.Drawing.Size(36130, 92); this.dataGridViewX2.TabIndex = 11; // // dataGridViewTextBoxColumn10 @@ -4567,7 +4567,7 @@ this.dataGridViewX3.ReadOnly = true; this.dataGridViewX3.RowHeadersVisible = false; this.dataGridViewX3.RowTemplate.Height = 23; - this.dataGridViewX3.Size = new System.Drawing.Size(35535, 127); + this.dataGridViewX3.Size = new System.Drawing.Size(36129, 127); this.dataGridViewX3.TabIndex = 5; this.dataGridViewX3.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX3_MouseDoubleClick); // @@ -4825,7 +4825,7 @@ this.dataGridViewX8.ReadOnly = true; this.dataGridViewX8.RowHeadersVisible = false; this.dataGridViewX8.RowTemplate.Height = 23; - this.dataGridViewX8.Size = new System.Drawing.Size(68, 92); + this.dataGridViewX8.Size = new System.Drawing.Size(34, 92); this.dataGridViewX8.TabIndex = 11; // // dataGridViewTextBoxColumn12 @@ -4920,7 +4920,7 @@ this.dataGridViewX9.ReadOnly = true; this.dataGridViewX9.RowHeadersVisible = false; this.dataGridViewX9.RowTemplate.Height = 23; - this.dataGridViewX9.Size = new System.Drawing.Size(142, 127); + this.dataGridViewX9.Size = new System.Drawing.Size(108, 127); this.dataGridViewX9.TabIndex = 5; this.dataGridViewX9.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX9_MouseDoubleClick); // @@ -5203,7 +5203,7 @@ this.dataGridViewX4.ReadOnly = true; this.dataGridViewX4.RowHeadersVisible = false; this.dataGridViewX4.RowTemplate.Height = 23; - this.dataGridViewX4.Size = new System.Drawing.Size(79, 92); + this.dataGridViewX4.Size = new System.Drawing.Size(45, 92); this.dataGridViewX4.TabIndex = 3; // // dataGridViewTextBoxColumn1 @@ -5288,7 +5288,7 @@ this.dataGridViewX5.ReadOnly = true; this.dataGridViewX5.RowHeadersVisible = false; this.dataGridViewX5.RowTemplate.Height = 23; - this.dataGridViewX5.Size = new System.Drawing.Size(81, 127); + this.dataGridViewX5.Size = new System.Drawing.Size(47, 127); this.dataGridViewX5.TabIndex = 5; this.dataGridViewX5.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX5_MouseDoubleClick); // diff --git a/ClassExpCad.cs b/ClassExpCad.cs new file mode 100644 index 0000000..f914c57 --- /dev/null +++ b/ClassExpCad.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.IO; +using System.Windows.Forms; +using DXFLibrary; +using System.Drawing; + +namespace Cyberpipe +{ + class ClassExpCad + { + public static void ExpDxfFromLayers(GSOFeatures features,string saveFilePath) + { + Dictionary layerNameAndColor=new Dictionary(); + for (int i = 0;i < features.Length;i++) + { + if (!layerNameAndColor.Keys.Contains(features[i].Dataset.Caption)) + layerNameAndColor.Add(features[i].Dataset.Caption, getShortColorFromFeature(features[i])); + } + + expGSOLayerToDxf(layerNameAndColor, features, saveFilePath); + } + + private static void expGSOLayerToDxf(Dictionary layerNameAndColor, + GSOFeatures features, string saveFilePath) + { + DXFLibrary.Document doc = new DXFLibrary.Document(); + DXFLibrary.Tables tables = new DXFLibrary.Tables(); + doc.SetTables(tables); + DXFLibrary.Table layers = new DXFLibrary.Table("LAYER"); + tables.addTable(layers); + + DXFLibrary.Layer layerDoors; + foreach (var layerName in layerNameAndColor) + { + layerDoors = new DXFLibrary.Layer(layerName.Key, layerName.Value, "CONTINUOUS"); + layers.AddTableEntry(layerDoors); + } + + for (int i = 0; i < features.Length; i++) + { + GSOGeoPolyline3D polyLine = features[i].Geometry as GSOGeoPolyline3D; + GSOPoint3d startPt = polyLine[0][0]; + GSOPoint3d endPt = polyLine[0][1]; + + DXFLibrary.Line line = new DXFLibrary.Line(features[i].Dataset.Caption, startPt.X, startPt.Y, endPt.X, endPt.Y); + doc.add(line); + } + + /* + DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + doc.add(cc); + */ + /* + DXFLibrary.Line line2 = new DXFLibrary.Line("Doors", 0, 0, 10, 0); + doc.add(line2); + DXFLibrary.Line line3 = new DXFLibrary.Line("Doors", 10, 10, 0, 10); + doc.add(line3); + DXFLibrary.Line line4 = new DXFLibrary.Line("Doors", 10, 10, 10, 0); + doc.add(line4); + DXFLibrary.Line3D line5 = new DXFLibrary.Line3D("Doors", 2, 2, 0, 5, 5, 10); + doc.add(line5); + + //DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors"); + //doc.add(cc); + */ + + FileStream fs = new FileStream(saveFilePath, System.IO.FileMode.Create); + DXFLibrary.Writer.Write(doc, fs); + fs.Close(); + } + + private static short getShortColorFromFeature(GSOFeature feature) + { + + short color = 30; + /* + GSOGeoPolyline3D polyLine = feature.Geometry as GSOGeoPolyline3D; + GSOPipeLineStyle3D line = GSOPipeLineStyle3D polyLine; + GSOExtendSectionLineStyle3D style1 = GSOExtendSectionLineStyle3D polyLine; + * * */ + return color; + + } + + } +} diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index 9dabf90..b3a557e 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -123,6 +123,10 @@ False bin\x86\Debug\DevComponents.Instrumentation.dll + + False + bin\x86\Debug\DXFLibrary.dll + False bin\x86\Debug\GSBalloonExDotNet.dll @@ -207,6 +211,7 @@ + diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3264c0b..24e3e41 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/MainFrm.cs b/MainFrm.cs index af50d21..5d18e03 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -2145,7 +2145,6 @@ dataGridViewX4.Rows[idx].Cells[0].Value = resLayer.Caption; var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; dataGridViewX4.Rows[idx].Cells[1].Value = featureName; - } } return; diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index 3bcedcf..39b4d34 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -4473,7 +4473,7 @@ this.dataGridViewX2.ReadOnly = true; this.dataGridViewX2.RowHeadersVisible = false; this.dataGridViewX2.RowTemplate.Height = 23; - this.dataGridViewX2.Size = new System.Drawing.Size(35536, 92); + this.dataGridViewX2.Size = new System.Drawing.Size(36130, 92); this.dataGridViewX2.TabIndex = 11; // // dataGridViewTextBoxColumn10 @@ -4567,7 +4567,7 @@ this.dataGridViewX3.ReadOnly = true; this.dataGridViewX3.RowHeadersVisible = false; this.dataGridViewX3.RowTemplate.Height = 23; - this.dataGridViewX3.Size = new System.Drawing.Size(35535, 127); + this.dataGridViewX3.Size = new System.Drawing.Size(36129, 127); this.dataGridViewX3.TabIndex = 5; this.dataGridViewX3.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX3_MouseDoubleClick); // @@ -4825,7 +4825,7 @@ this.dataGridViewX8.ReadOnly = true; this.dataGridViewX8.RowHeadersVisible = false; this.dataGridViewX8.RowTemplate.Height = 23; - this.dataGridViewX8.Size = new System.Drawing.Size(68, 92); + this.dataGridViewX8.Size = new System.Drawing.Size(34, 92); this.dataGridViewX8.TabIndex = 11; // // dataGridViewTextBoxColumn12 @@ -4920,7 +4920,7 @@ this.dataGridViewX9.ReadOnly = true; this.dataGridViewX9.RowHeadersVisible = false; this.dataGridViewX9.RowTemplate.Height = 23; - this.dataGridViewX9.Size = new System.Drawing.Size(142, 127); + this.dataGridViewX9.Size = new System.Drawing.Size(108, 127); this.dataGridViewX9.TabIndex = 5; this.dataGridViewX9.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX9_MouseDoubleClick); // @@ -5203,7 +5203,7 @@ this.dataGridViewX4.ReadOnly = true; this.dataGridViewX4.RowHeadersVisible = false; this.dataGridViewX4.RowTemplate.Height = 23; - this.dataGridViewX4.Size = new System.Drawing.Size(79, 92); + this.dataGridViewX4.Size = new System.Drawing.Size(45, 92); this.dataGridViewX4.TabIndex = 3; // // dataGridViewTextBoxColumn1 @@ -5288,7 +5288,7 @@ this.dataGridViewX5.ReadOnly = true; this.dataGridViewX5.RowHeadersVisible = false; this.dataGridViewX5.RowTemplate.Height = 23; - this.dataGridViewX5.Size = new System.Drawing.Size(81, 127); + this.dataGridViewX5.Size = new System.Drawing.Size(47, 127); this.dataGridViewX5.TabIndex = 5; this.dataGridViewX5.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX5_MouseDoubleClick); // diff --git a/bin/x86/Debug/DXFLibrary.dll b/bin/x86/Debug/DXFLibrary.dll new file mode 100644 index 0000000..6851fdc --- /dev/null +++ b/bin/x86/Debug/DXFLibrary.dll Binary files differ