Beispiel #1
0
        void Initialize(PackagedArcs packagedArcs)
        {
            int arcStart = 0;

            this.weightedItems  = new List <WeightedItem>();
            this.weightedPoints = new Dictionary <CoordPoint, double>();
            this.weights        = new List <double>();

            for (int i = 0; i < packagedArcs.ArcsLength.Count; ++i)
            {
                IList <double> arcWeights = this.weightsCalculator.CalculateWeights(MapUtils.GetSubSequence(packagedArcs.ArcsPoints, arcStart, arcStart + packagedArcs.ArcsLength[i]));
                this.weights.AddRange(arcWeights);

                if (!this.weightedPoints.ContainsKey(packagedArcs.ArcsPoints[arcStart]))
                {
                    this.weightedPoints.Add(packagedArcs.ArcsPoints[arcStart], double.PositiveInfinity);
                }
                if (!this.weightedPoints.ContainsKey(packagedArcs.ArcsPoints[arcStart + packagedArcs.ArcsLength[i] - 1]))
                {
                    this.weightedPoints.Add(packagedArcs.ArcsPoints[arcStart + packagedArcs.ArcsLength[i] - 1], double.PositiveInfinity);
                }

                for (int j = arcStart + 1; j < arcStart + packagedArcs.ArcsLength[i] - 1; ++j)
                {
                    if (!this.weightedPoints.ContainsKey(packagedArcs.ArcsPoints[j]))
                    {
                        this.weightedPoints.Add(packagedArcs.ArcsPoints[j], arcWeights[j - arcStart - 1]);
                    }
                }
                arcStart += packagedArcs.ArcsLength[i];
            }
        }
Beispiel #2
0
        public void Process(IEnumerable <MapItem> items)
        {
            PackagedArcs    packagedPolygons = new PackagedArcs(items);
            PolygonsSpliter polygonsSpliter  = new PolygonsSpliter(packagedPolygons);
            PackagedArcs    arcs             = polygonsSpliter.Split();

            Initialize(arcs);
            this.weights.Sort();
            this.weightedItems = ProcessItems(items);
        }
 public PolygonsSpliter(PackagedArcs packagedPolygons)
 {
     this.polygonsPoints = packagedPolygons.ArcsPoints;
     this.polygonsLength = packagedPolygons.ArcsLength;
 }