Пример #1
0
 public void Execute()
 {
     if (parent.NoIntersect == true)
     {
         if (IntersectionHelperClass.BoundaryIntersectionSearch(parent.VectorList, point.PointNum))
         {
             ErrorHelper.SendUserError("Region Point Not Deleted", "Region", app.Config.ErrorDisplayTimeDefault, true, this, app);
             return;
         }
     }
     parent.Remove(point);
 }
 protected bool PointValidate(List <Vector3> points, Vector3 location)
 {
     if (!IntersectionHelperClass.BoundaryIntersectionSearch(points, location, points.Count))
     {
         AddPointCommand addCmd = new AddPointCommand(region.Points, location);
         app.ExecuteCommand(addCmd);
     }
     else
     {
         ErrorHelper.SendUserError("Add region point failed", "Region", app.Config.ErrorDisplayTimeDefault, true, this, app);
     }
     return(true);
 }
        public bool DragCallback(bool accept, Vector3 loc)
        {
            placing        = false;
            placedPosition = loc;
            Vector3 location = loc;

            if (accept)
            {
                if (type == MPPointType.Boundary)
                {
                    if ((((obj).Parent) as PointCollection).NoIntersect)
                    {
                        PointCollection pc   = obj.Parent as PointCollection;
                        int             i    = 0;
                        List <Vector3>  list = new List <Vector3>();
                        foreach (Vector3 point in pc.VectorList)
                        {
                            if (i == obj.PointNum)
                            {
                                list.Add(location);
                            }
                            else
                            {
                                list.Add(point);
                            }
                            i++;
                        }
                        if (IntersectionHelperClass.BoundaryIntersectionSearch(obj.PointNum, list))
                        {
                            ErrorHelper.SendUserError("Unable to move point to that Position", "Region", app.Config.ErrorDisplayTimeDefault, true, (object)obj, app);
                            obj.Position       = origPosition;
                            app.MouseDragEvent = false;
                            return(true);
                        }
                    }
                }
                loc.y          = app.GetTerrainHeight(loc.x, loc.z);
                placedPosition = loc;
                obj.Position   = loc;

                app.MouseDragEvent = false;
                return(true);
            }
            obj.Position       = origPosition;
            app.MouseDragEvent = false;
            return(false);
        }
        public bool AddPoint(Vector3 location, out int index)
        {
            bool ret = true;

            index = 0;

            if (noIntersect)
            {
                if (IntersectionHelperClass.BoundaryIntersectionSearch(this.VectorList, location, points.Count))
                {
                    ErrorHelper.SendUserError("Adding point to region failed", "Region", app.Config.ErrorDisplayTimeDefault, true, this, app);
                    return(false);
                }
            }
            MPPoint pt = new MPPoint(Count, this, app, markerMeshName, markerMaterialName, location, this.type);

            Add(pt);
            index = pt.PointNum;
            this.UpdateFocus(FocusLocation);
            return(ret);
        }
Пример #5
0
 protected bool PointValidate(List <Vector3> points, Vector3 location, int index)
 {
     if (parent.NoIntersect)
     {
         if (!IntersectionHelperClass.BoundaryIntersectionSearch(points, location, index + 1))
         {
             parent.Insert(index, new MPPoint(index + 1, parent, app, dragObject.MeshName, dragObject.MaterialName, location, MPPointType.Boundary));
             return(true);
         }
         else
         {
             ErrorHelper.SendUserError("Add region point failed", "Region", app.Config.ErrorDisplayTimeDefault, true, this, app);
             return(false);
         }
     }
     else
     {
         parent.Insert(index, new MPPoint(index + 1, parent, app, dragObject.MeshName, dragObject.MaterialName, location, MPPointType.Road));
         return(true);
     }
 }