ArcStrabo10.ArcStraboObject.SymbolExtraction C# (CSharp) Метод

SymbolExtraction() публичный Метод

public SymbolExtraction ( ) : void
Результат void
        public void SymbolExtraction()
        {
            try
            {
                List<Bitmap> imgfnp_list = new List<Bitmap>();
                List<Bitmap> imgfnn_list = new List<Bitmap>();

                Image<Bgr, Byte> srcImage = new Image<Bgr, byte>(_rasterInfo.ratserImgPath);

                //sourceImageDir = CreateDirectory(parentInfo.FullName, "Data");
                ////////////////////Geo Spatial PRoject Sima//////////////////////

                fillSymbolList(imgfnp_list, srcImage);

                Image<Gray, Byte> gElement = null;

                HashSet<float[]> hash = symbolRecognition(out gElement, _rasterInfo.rasterData);

                coordinatePoints = new CoordinatePoint[hash.Count];
                pointSet = new Points[hash.Count];

                //....................................................................
                int j = 0;

                foreach (float[] i in hash)
                {
                    double lng, lat, x, y;
                    int neg = 1;
                    if (i[1] > 0 && _rasterInfo.ratserNegative < 0)
                        neg = _rasterInfo.ratserNegative;
                    pointSet[j] = new Points();
                    pointSet[j].leftTopX = i[0];
                    pointSet[j].leftTopY = i[1] * neg;
                    pointSet[j].rightTopX = i[0] + gElement.Size.Width;
                    pointSet[j].rightTopY = i[1] * neg;
                    pointSet[j].leftDownX = i[0];
                    pointSet[j].leftDownY = (i[1] + gElement.Size.Height) * neg;
                    pointSet[j].rightDownX = i[0] + gElement.Size.Width;
                    pointSet[j].rightDownY = (i[1] + gElement.Size.Height) * neg;

                    if (_rasterInfo.rasterType != "Unknown")
                    {

                        x = i[0] + gElement.Size.Width / 2;
                        y = i[1] + gElement.Size.Height / 2;
                        getLngLat(x, y, out lng, out lat);
                        coordinatePoints[j] = new CoordinatePoint();
                        coordinatePoints[j].lng = lng;
                        coordinatePoints[j].lat = lat;
                    }

                    j++;

                }
                #region Geo-Spatial Project- Connection to DBpredia
                if (_rasterInfo.rasterType != "Unknown")
                {
                    bindURI();
                    int num = 0;
                    foreach (CoordinatePoint pn in coordinatePoints)
                    {
                        pointSet[num].URI = pn.URI;
                        num++;
                    }
                }
                #endregion

            }
            catch (Exception e)
            {
                Log.WriteLine("textLayerExtract:  " + e.Message);
            }
        }

Usage Example

        protected override void OnClick()
        {
            #region Symbel Recognition
            ArcStrabo10.ArcStraboObject.RasterMapInfo rasterInfo = new ArcStrabo10.ArcStraboObject.RasterMapInfo();
            string dir = "";
            ArcStraboObject arcStraboObject = new ArcStraboObject();
            arcStraboObject.symbolFindRasterLayerPath(rasterInfo);

            string logPath = arcStraboObject.CreateDirectory(rasterInfo.rasterPath, "Log");

            Log.SetLogDir(System.IO.Path.GetTempPath());
            Log.SetOutputDir(System.IO.Path.GetTempPath());
            Log.SetStartTime();
            Log.WriteLine("Start");
            Log.WriteLine("MakingGeoJsonFile Mathod Start  SIMA");
            IMap map = ArcMap.Document.FocusMap;
            arcStraboObject.MakingSymbolGeoJsonFile();
            Log.WriteLine("MakingGeoJsonFile Mathod Finish");

            ////run TextExtraction Layer from Strao.core and load raster Layer
            Log.WriteLine("textLayerExtract Mathod Start SIMA");

            dir =rasterInfo.ratserImgPath;
            arcStraboObject.SymbolExtraction();
            Log.WriteLine("textLayerExtract Mathod Finish");

            /////Add Polygon of OCR Layer
            Log.WriteLine("CreateFeatureClassWithFields Mathod Start SIMA");
            IWorkspace workspace = arcStraboObject.symbolCreateShapefileWorkspace();
            IFeatureWorkspace featureworkspace = (IFeatureWorkspace)workspace;

            IFeatureClass featureClass = arcStraboObject.CreateFeatureClassWithFieldsGeoRef(ArcStrabo10Extension.TextLayerOCRShapefile, featureworkspace);
            IFeatureLayer featureLayer = arcStraboObject.CreateFeatureLayer(featureClass);
            Log.WriteLine("CreateFeatureClassWithFields Mathod Finish");

            Log.WriteLine("AddPolygon Mathod Start");
            arcStraboObject.addPoligonGeorefrenced(featureLayer, featureworkspace);
            Log.WriteLine("AddPolygon Mathod Finish");

            #endregion
        }