public static void CalculateGeodesicDistanceFromSourcePointToAllPointsWithMovement(Cl3DModel.Cl3DModelPointIterator p_BasicPoint, string p_SepcificPointNameToWhichDistanceWillBeCalculated, Dictionary<uint, uint> movement)
        {
            List<Cl3DModel.Cl3DModelPointIterator> ListToCheck = null;
            List<Cl3DModel.Cl3DModelPointIterator> NewListToCheck = new List<Cl3DModel.Cl3DModelPointIterator>();

            NewListToCheck.Add(p_BasicPoint);
            p_BasicPoint.AddSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, 0.0f);

            do
            {
                ListToCheck = NewListToCheck;
                NewListToCheck = new List<Cl3DModel.Cl3DModelPointIterator>();

                for (int i = 0; i < ListToCheck.Count; i++)
                {
                    Cl3DModel.Cl3DModelPointIterator currentPoint = ListToCheck[i];
                    if (movement != null)
                    {
                        uint testID;
                        if (movement.TryGetValue(currentPoint.PointID, out testID))
                        {
                            double value = currentPoint.GetSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated);
                            uint OldId = currentPoint.PointID;
                            if (!currentPoint.MoveToPoint(testID))
                                throw new Exception("Cannot move a point in to the point with no: " + testID.ToString());

                            currentPoint.AddSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, value);
                            currentPoint.AddSpecificValue("Path", OldId);
                        }
                    }

                    List<Cl3DModel.Cl3DModelPointIterator> Neighbors = currentPoint.GetListOfNeighbors();
                    foreach (Cl3DModel.Cl3DModelPointIterator point in Neighbors)
                    {
                        float CurrentDistance = currentPoint - point;

                        double OldDistance = 0;
                        if (!currentPoint.GetSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, out OldDistance))
                            throw new Exception("Cannot get specific value: " + p_SepcificPointNameToWhichDistanceWillBeCalculated.ToString());

                        double SavedPointDistance = 0;
                        if (point.GetSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, out SavedPointDistance))
                        {
                            if (SavedPointDistance > OldDistance + CurrentDistance) // check if we maybe have shorter path to this point
                            {
                                point.AddSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, OldDistance + CurrentDistance);
                                point.AddSpecificValue("Path", currentPoint.PointID);
                                NewListToCheck.Add(point);
                            }
                        }
                        else
                        {
                            //can be corrected because we have right now possibility to save distance in the point not different list
                            point.AddSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, OldDistance + CurrentDistance);
                            point.AddSpecificValue("Path", currentPoint.PointID);
                            NewListToCheck.Add(point);
                        }
                    }
                }
            } while (NewListToCheck.Count != 0);
            p_BasicPoint.GetManagedModel().ResetVisitedPoints();
        }
 public static void GetPathBetweenPoints(Cl3DModel.Cl3DModelPointIterator p_StartPoint, Cl3DModel.Cl3DModelPointIterator p_EndPoint, out List<Cl3DModel.Cl3DModelPointIterator> p_Path)
 {
     p_Path = new List<Cl3DModel.Cl3DModelPointIterator>();
     ClTools.CalculateGeodesicDistanceFromSourcePointToAllPoints(p_StartPoint, Cl3DModel.Cl3DModelPointIterator.eSpecificValues.GeodesicDistanceFromPoint.ToString());
     Cl3DModel.Cl3DModelPointIterator iter = p_EndPoint.CopyIterator();
     while (iter.IsSpecificValueCalculated("Path"))
     {
         uint PiD = (uint)iter.GetSpecificValue("Path");
         iter.MoveToPoint(PiD);
         p_Path.Add(iter.CopyIterator());
     }
     p_Path.Add(p_StartPoint);
     Cl3DModel.Cl3DModelPointIterator itRemove = p_StartPoint.GetManagedModel().GetIterator();
     do
     {
         itRemove.RemoveSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.GeodesicDistanceFromPoint);
         itRemove.RemoveSpecificValue("Path");
     } while (itRemove.MoveToNext());
 }
        //----------------------------------------------------------------------------
        public static void CalculateGeodesicDistanceFromSourcePointToAllPoints(Cl3DModel.Cl3DModelPointIterator p_BasicPoint, string p_SepcificPointNameToWhichDistanceWillBeCalculated)
        {
            Cl3DModel.Cl3DModelPointIterator iter = p_BasicPoint.GetManagedModel().GetIterator();
            do
            {
                if (iter.IsSpecificValueCalculated(p_SepcificPointNameToWhichDistanceWillBeCalculated))
                    iter.RemoveSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated);
            } while (iter.MoveToNext());

            p_BasicPoint.AlreadyVisited = true;

            List<Cl3DModel.Cl3DModelPointIterator> ListToCheck = null;
            List<Cl3DModel.Cl3DModelPointIterator> NewListToCheck = new List<Cl3DModel.Cl3DModelPointIterator>();

            NewListToCheck.Add(p_BasicPoint);
            p_BasicPoint.AddSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, 0.0f);

            do
            {
                ListToCheck = NewListToCheck;
                NewListToCheck = new List<Cl3DModel.Cl3DModelPointIterator>();

                for (int i = 0; i < ListToCheck.Count; i++)
                {
                    Cl3DModel.Cl3DModelPointIterator currentPoint = ListToCheck[i];

                    List<Cl3DModel.Cl3DModelPointIterator> Neighbors = currentPoint.GetListOfNeighbors();
                    foreach (Cl3DModel.Cl3DModelPointIterator point in Neighbors)
                    {
                        float CurrentDistance = currentPoint - point;

                        double OldDistance = 0;
                        if (!currentPoint.GetSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, out OldDistance))
                            throw new Exception("Cannot get specific value: " + p_SepcificPointNameToWhichDistanceWillBeCalculated.ToString());

                        if (point.IsSpecificValueCalculated(p_SepcificPointNameToWhichDistanceWillBeCalculated))// if point was already visited, check if we dont have sometimes shorter path to it
                        {
                            double SavedPointDistance = 0;
                            if (!point.GetSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, out SavedPointDistance))
                                throw new Exception("Cannot get specific value: " + p_SepcificPointNameToWhichDistanceWillBeCalculated.ToString());

                            if (SavedPointDistance > OldDistance + CurrentDistance) // check if we maybe have shorter path to this point
                            {
                                point.AddSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, OldDistance + CurrentDistance);
                                point.AddSpecificValue("Path", currentPoint.PointID);
                                NewListToCheck.Add(point);
                            }
                        }
                        else
                        {
                            //can be corrected because we have right now possibility to save distance in the point not different list
                            point.AddSpecificValue(p_SepcificPointNameToWhichDistanceWillBeCalculated, OldDistance + CurrentDistance);
                            point.AddSpecificValue("Path", currentPoint.PointID);
                            NewListToCheck.Add(point);
                        }
                    }
                }
            } while (NewListToCheck.Count != 0);
            p_BasicPoint.GetManagedModel().ResetVisitedPoints();
        }
        public static void GetNeighborhoodWithEuclideanDistanceCheckAllModel(out List<Cl3DModel.Cl3DModelPointIterator> p_pNeighborhood, Cl3DModel.Cl3DModelPointIterator p_BasicPoint, float p_fDistance)
        {
            p_pNeighborhood = new List<Cl3DModel.Cl3DModelPointIterator>();
            Cl3DModel.Cl3DModelPointIterator iter = p_BasicPoint.GetManagedModel().GetIterator();
            if (iter.IsValid())
            {
                do
                {
                    float disance = CalculateEuclideanDistance(iter, p_BasicPoint);
                    if (disance <= p_fDistance && iter.PointID != p_BasicPoint.PointID)
                    {
                        p_pNeighborhood.Add(iter.CopyIterator());
                    }

                } while (iter.MoveToNext());

            }
        }