Esempio n. 1
0
 public PointObject(PointObject pickset, Vector3d translate)
 {
     SouStart = pickset.SouStart + translate;
     SouEnd   = pickset.SouEnd + translate;
     DesStart = pickset.DesStart + translate;
     DesEnd   = pickset.DesEnd + translate;
 }
Esempio n. 2
0
    // ========== Public Methods ==========
    public GameObject GetObject(PointObjectType type)
    {
        GameObject gotObject = null;

        foreach (GameObject obj in _pool)
        {
            // LogUtils.instance.Log(GetClassName(), "GET_OBJECT", obj.activeSelf.ToString());
            PointObject basePointObject = obj.GetComponent <PointObject>();
            if (basePointObject != null && basePointObject.type == type && obj.activeSelf == false)
            {
                // LogUtils.instance.Log(GetClassName(), "GetObject", obj.activeSelf.ToString());
                gotObject = obj;
                break;
            }
        }
        if (gotObject == null)
        {
            gotObject = CreateObject(type);
        }

        if (gotObject != null)
        {
            gotObject.transform.position = new Vector3(-100, -100, 0);
            gotObject.SetActive(true);
        }

        return(gotObject);
    }
Esempio n. 3
0
        public CreatePointObject()
        {
            InitializeComponent();

            foreach (var type in PointObject.ValidTypes)
            {
                var typeName = PointObject.GetTypeNameFromId(type);

                types.Add(typeName, type);

                cmbType.Items.Add(typeName);
            }

            if (PointObject.ValidTypes.Length > 0)
            {
                cmbType.SelectedIndex = 0;
            }

            Text           = Strings.CreatePointObject;
            lblId.Text     = Strings.ID;
            lblMapId.Text  = Strings.MapID;
            lblType.Text   = Strings.Type;
            lblX.Text      = Strings.XPos;
            lblY.Text      = Strings.YPos;
            btnCreate.Text = Strings.Create;

            this.SetFonts();
        }
Esempio n. 4
0
    private GameObject CreateObject(PointObjectType type, Transform parent = null)
    {
        // LogUtils.instance.Log(GetClassName(), "CreateObject");
        GameObject objectPrefab  = null;
        GameObject createdObject = null;

        // LogUtils.instance.Log(GetClassName(), "_prefabsList length", (_prefabsList.Count).ToString());
        foreach (GameObject prefab in _prefabsList)
        {
            PointObject baseObject = prefab.GetComponent <PointObject>();
            // LogUtils.instance.Log(GetClassName(), "baseObject", (baseObject.type).ToString());
            if (baseObject != null && baseObject.type == type)
            {
                // LogUtils.instance.Log(GetClassName(), "CreateObject", (baseObject.type == type).ToString());
                objectPrefab = prefab;
                break;
            }
        }
        // LogUtils.instance.Log(GetClassName(), "CreateObject", "(objectPrefab != null)", (objectPrefab != null).ToString());
        if (objectPrefab != null)
        {
            if (parent == null)
            {
                parent = _instance.transform;
            }
            createdObject = GameObject.Instantiate(objectPrefab, Vector3.zero, Quaternion.identity, parent);
            if (createdObject != null)
            {
                // LogUtils.instance.Log(GetClassName(), "CreateObject", "(createdObject != null)", (createdObject != null).ToString());
                createdObject.SetActive(false);
                _pool.Add(createdObject);
            }
        }
        return(createdObject);
    }
Esempio n. 5
0
        public static PointObject GetPointObject(BaseObject iObj)
        {
            global::System.IntPtr cPtr = C4dApiPINVOKE.PointObject_GetPointObject(BaseObject.getCPtr(iObj));
            PointObject           ret  = (cPtr == global::System.IntPtr.Zero) ? null : new PointObject(cPtr, false);

            return(ret);
        }
Esempio n. 6
0
        public void checkRootCostandRenewCost(PointObject checkingpoint)
        {
            int beforeX, beforeY, afterX, afterY;

            beforeX = checkingpoint.pointX;
            beforeY = checkingpoint.pointY;

            foreach (var lists in pointlist[beforeX, beforeY].returnRootList())
            {
                if (!lists.afterPoint.isDitermind())                                                             //決定済みでなければコスト更新判定を続ける
                {
                    if (lists.afterPoint.checkCostFromstart() > checkingpoint.checkCostFromstart() + lists.cost) //costfromstartが低くなるのであれば、低くする
                    {
                        lists.afterPoint.changeCostFromstart(lists.afterPoint.checkCostFromstart() + lists.cost);
                        lists.afterPoint.setEstimatedCost();

                        if (!lists.afterPoint.checkAddOpenFlag())                          //オープンリストに追加されていなければ追加する。
                        {
                            openlist.Add(lists.afterPoint);
                            lists.afterPoint.AddOpenFlag();
                        }
                    }
                }
            }
            this.searchMinimamPointandDetermine();
        }
Esempio n. 7
0
        private void setJointWeight(int tagPos, BaseObject op2, PointObject pObj)
        {
            BaseTag      t              = op2.GetTag(C4dApi.Tpointselection, tagPos);
            SelectionTag st             = (SelectionTag)op2.GetTag(C4dApi.Tpolygonselection);
            BaseSelect   SelectedPoints = st.GetBaseSelect();

            if (t.GetName() == null)
            {
            }
            else
            {
                string selectioname = t.GetName();
                for (int j = 0; j < this.wtagGlob.GetJointCount(); j++)
                {
                    if (selectioname == this.wtagGlob.GetName())
                    {
                        for (int i = 0; i < pObj.GetPointCount(); i++)
                        {
                            if (SelectedPoints.IsSelected(i))
                            {
                                this.wtagGlob.SetWeight(1, i, 0.04);
                                setJointWeight(tagPos + 1, op2, pObj);
                                //C4dApi.GePrint("Der Punkt mit dem Index " + i + " ist selektiert");
                            }
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        private PointObject StringToObject(string strQuery)
        {
            try
            {
                String[] splitted = Str.Split(strQuery, '&');

                PointObject po = new PointObject();
                po.Value            = Convert.ToInt64(splitted[0]);
                po.Customer         = Customer.FindByCode(splitted[1]);
                po.DocumentDate     = DateTime.Parse(splitted[2]);
                po.OfficeID         = splitted[3];
                po.RegisterID       = splitted[4];
                po.RegisterFiscalID = splitted[5];
                po.ZNo            = Convert.ToInt32(splitted[6]);
                po.DocumentNo     = Convert.ToInt32(splitted[7]);
                po.DocumentTotal  = Decimal.Parse(splitted[8]);
                po.DocumentTypeID = Convert.ToInt32(splitted[9]);
                po.Description    = splitted[10];

                return(po);
            }
            catch (Exception)
            {
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 9
0
        private void AddObject()
        {
            var id     = int.Parse(txtId.Text);
            var typeId = GetTypeIdFromName(cmbType.Text);

            // Portals, respawns, and none should have ID 0
            if (typeId == 0x01 || typeId == 0x02)
            {
                id = 0;
            }
            else
            {
                // Check for a duplicate ID
                if (Map.PointObjects.Exists(p => p.Type == typeId && p.Id == id))
                {
                    MessageBox.Show("Duplicate ID found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            var point = new PointObject()
            {
                Id    = id,
                Type  = typeId,
                MapId = int.Parse(txtMapId.Text),
                X     = int.Parse(txtX.Text),
                Y     = int.Parse(txtY.Text)
            };

            Map.PointObjects.Add(point);
            PointListForm.RepopulateData();
        }
Esempio n. 10
0
        public IList <SequenceData> OutputSequence(IList <MotionObjectInfo> selected, IList <ProcParam <MotionProcEnv> > args, IEnumerable <ReadOnlyMotionFrame> frames, ProgressInformation progressInfo)
        {
            List <SequenceData> ret = new List <SequenceData>();

            foreach (MotionObjectInfo info in selected)
            {
                TimeSeriesValues values = new TimeSeriesValues("x", "y", "z");
                foreach (var frame in frames)
                {
                    PointObject point = frame[info] as PointObject;
                    if (point != null)
                    {
                        try {
                            values[frame.Time] = new decimal?[] { (decimal)point.Position.X, (decimal)point.Position.Y, (decimal)point.Position.Z };
                        } catch (ArithmeticException) {
                            values[frame.Time] = null;
                        }
                    }
                    else
                    {
                        values[frame.Time] = null;
                    }
                }
                SequenceData data = new SequenceData(values, null, PathEx.GiveName("Position", info.Name));
                ret.Add(data);
            }
            return(ret);
        }
Esempio n. 11
0
 public void SetObjectValue(int index,PointObject value)
 {
     if(objects[index] != null)
     {
         objects[index].ReplacingObject(value);
     }
     objects[index] = value;
 }
Esempio n. 12
0
        public string Hello(PointObject startPoint)
        {
            // convert to real Point
            var p = new Point(1, 2);

            // convert to PointOutput
            return("da");
        }
Esempio n. 13
0
        public IList <SequenceData> OutputSequence(IList <MotionObjectInfo> selected, IList <ProcParam <MotionProcEnv> > args, IEnumerable <ReadOnlyMotionFrame> frames, ProgressInformation progressInfo)
        {
            MotionObjectSingleSelectParameter main = args[0] as MotionObjectSingleSelectParameter;
            SingleSelectParameter             unit = args[1] as SingleSelectParameter;

            bool                     useRatio      = unit.Value == 0;
            MotionObjectInfo         firstAxis     = main.Value;
            MotionObjectInfo         secondAxis    = selected.Where(info => info.IsTypeOf(typeof(LineObject)) && info != firstAxis).First();
            IList <MotionObjectInfo> pointInfoList = selected.Where(info => info.IsTypeOf(typeof(PointObject))).ToList();
            List <SequenceData>      ret           = new List <SequenceData>();

            foreach (MotionObjectInfo pointInfo in pointInfoList)
            {
                TimeSeriesValues values = new TimeSeriesValues("axis1", "axis2", "axis3");
                foreach (var frame in frames)
                {
                    PointObject point     = frame[pointInfo] as PointObject;
                    LineObject  line1     = frame[firstAxis] as LineObject;
                    LineObject  line2     = frame[secondAxis] as LineObject;
                    decimal?[]  relValues = null;
                    if (point != null && line1 != null && line2 != null)
                    {
                        Vector3 anchor      = line1.Position;
                        Vector3 pointRelPos = point.Position - anchor;
                        Vector3 axis1       = line1.Edge;
                        Vector3 axis2       = line2.Edge;
                        Vector3 axis1norm   = Vector3.Normalize(axis1);
                        Vector3 axis2norm   = Vector3.Normalize(axis2);
                        Vector3 axis3       = Vector3.Cross(axis1norm, axis2norm) * (float)Math.Sqrt(axis1.Length() * axis2.Length());

                        if (!useRatio)
                        {
                            axis1 = Vector3.Normalize(axis1);
                            axis2 = Vector3.Normalize(axis2);
                            axis3 = Vector3.Normalize(axis3);
                        }
                        float[,] mat = new float[, ] {
                            { axis1.X, axis2.X, axis3.X }, { axis1.Y, axis2.Y, axis3.Y }, { axis1.Z, axis2.Z, axis3.Z }
                        };
                        float[] vec = new float[] { pointRelPos.X, pointRelPos.Y, pointRelPos.Z };
                        SimultaneousEquations solve = SimultaneousEquations.Solve(mat, vec);
                        if (solve.Answers.Length == 3)
                        {
                            relValues = new decimal?[3];
                            try {
                                relValues[0] = (decimal)solve.Answers[0];
                                relValues[1] = (decimal)solve.Answers[1];
                                relValues[2] = (decimal)solve.Answers[2];
                            } catch (OverflowException) { relValues = null; }
                        }
                    }
                    values.SetValue(frame.Time, relValues);
                }
                SequenceData data = new SequenceData(values, null, PathEx.GiveName("RelPos", pointInfo.Name));
                ret.Add(data);
            }
            return(ret);
        }
Esempio n. 14
0
 public void createDefaltPointList()          //ポイントオブジェクトの配列のデフォルトデータを作成するメソッド
 {
     for (int i = 0; i < listlength; i++)
     {
         for (int j = 0; j < listlength; j++)
         {
             pointlist[i, j] = new PointObject(i, j);
         }
     }
 }
Esempio n. 15
0
    void SelectPoint(PointObject p)
    {
        if (selectedPoint != null)
        {
            selectedPoint.Release();
        }

        selectedPoint = p;
        p.Select();
    }
Esempio n. 16
0
    // Update is called once per frame
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("Detect Point");

        PointObject po = other.gameObject.GetComponent <PointObject>();

        points.Add(po);

        //points.Clear();
    }
Esempio n. 17
0
        TimeSpan GetAverageTime(PointObject p)
        {
            var times = Enumerable.Range(p.Id - NeighborsCount / 2, NeighborsCount)
                        .Select(id => Points[id.Mod(PointsCount)].SignalTime)
                        .ToArray();

            return(times.Any(t => t == TimeSpan.Zero) ?
                   p.SignalTime :
                   new TimeSpan((long)times.Average(t => t.Ticks)));
        }
Esempio n. 18
0
        public long UpdatePoint(PointObject pointObj)
        {
            IPointAdapter adapter = Connector.Instance().PointAdapter;

            if (adapter != null)
            {
                adapter.UpdatePoint(pointObj);
            }
            points += pointObj.Value;
            return(points);
        }
Esempio n. 19
0
 public SwitchGroupObject(BinaryReader reader)
 {
     SwitchId        = reader.ReadUInt32();
     GameParameterId = reader.ReadUInt32();
     PointNumber     = reader.ReadUInt32();
     Points          = new PointObject[PointNumber];
     for (int i = 0; i < Points.Length; i++)
     {
         Points[i] = new PointObject(reader);
     }
 }
Esempio n. 20
0
        public void Test()
        {
            var testCase          = new PointObject();
            var conversionContext = new Definitions();

            Assert.False(testCase.Module.Convert(conversionContext).Interpet(InterpetedContext.Root()).IsReturn(out var _, out var res));

            var scope = res.Value.Cast <IInterpetedScope>().GetMember <IInterpetedAnyType>(new NameKey("point")).Value;

            Assert.True(scope.Cast <IInterpetedScope>().ContainsMember(new NameKey("x")));
            Assert.True(scope.Cast <IInterpetedScope>().ContainsMember(new NameKey("y")));
        }
Esempio n. 21
0
 public PointObject(int x, int y)
 {
     pointX            = x;
     pointY            = y;
     costFromStart     = 9999;
     determined        = false;
     checking          = false;
     startFlag         = false;
     goalFlag          = false;
     addedOpenlistFlag = false;
     rootList          = new List <root>();
     parentPoint       = null;
 }
Esempio n. 22
0
        private void loadPhaseSpace(PhaseSpaceDataReader reader)
        {
            WaitForForm waitForm = new WaitForForm(ctrl => {
                try {
                    _dataSet.ClearFrame();
                    _dataSet.ClearObject();
                    Dictionary <int, uint> index2id = new Dictionary <int, uint>();
                    int count = 1;
                    while (!reader.EndOfStream)
                    {
                        PhaseSpaceFrame inFrame = reader.ReadFrame();

                        MotionFrame outFrame = new MotionFrame(_dataSet, inFrame.Time);
                        for (int i = 0; i < inFrame.Markers.Length; i++)
                        {
                            uint id;
                            if (!index2id.TryGetValue(i, out id))
                            {
                                MotionObjectInfo newInfo = new MotionObjectInfo(typeof(PointObject));
                                newInfo.Name             = PathEx.CombineName("unnamed", (i + 1).ToString());
                                _dataSet.AddObject(newInfo);
                                id = index2id[i] = newInfo.Id;
                            }
                            if (inFrame.Markers[i].Condition > 0)
                            {
                                outFrame[id] = new PointObject(new Vector3(inFrame.Markers[i].X, inFrame.Markers[i].Y, inFrame.Markers[i].Z));
                            }
                        }
                        _dataSet.AddFrame(outFrame);

                        ctrl.ReportProgress(99 - 990000 / (count + 10000), string.Format("Load Frame: {0} ({1} sec)", count, inFrame.Time.ToString("0.00")));
                        count++;
                    }
                    ctrl.ReportProgress(100, string.Format("Done"));
                    ctrl.DialogResult = DialogResult.OK;
                } catch (Exception) {
                    _dataSet.ClearObject();
                    _dataSet.ClearFrame();
                    _dataSet.DoObjectInfoSetChanged();
                    _dataSet.DoFrameListChanged();
                    throw;
                }
            });

            if (waitForm.ShowDialog() == DialogResult.OK)
            {
                _dataSet.DoObjectInfoSetChanged();
                _dataSet.DoFrameListChanged();
            }
        }
Esempio n. 23
0
        public void Test()
        {
            var testCase          = new PointObject();
            var conversionContext = new Definitions();

            var module = testCase.RootScope.Convert(conversionContext).SafeCastTo(out Tac.Backend.Interpreted.Syntaz_Model_Interpeter.Elements.InterpetedRootScope _);

            var(scope, value) = module.InterpetWithExposedScope(InterpetedContext.Root());

            Assert.False(value.IsReturn(out var _, out var res));

            var pointScope = scope.GetMember(new NameKey("point")).Value;

            Assert.True(pointScope.CastTo <IInterpetedScope>().ContainsMember(new NameKey("x")));
            Assert.True(pointScope.CastTo <IInterpetedScope>().ContainsMember(new NameKey("y")));
        }
Esempio n. 24
0
    // ------------------------------------

    void AddPoint()
    {
        Vector3 pos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane));

        pos.y = 0f;

        GameObject o = Instantiate(pointObjectPrefab, pos, Quaternion.identity) as GameObject;

        o.transform.parent = pointsWrapper;
        PointObject p = o.GetComponent <PointObject>();

        points.Add(p);
        SelectPoint(p);

        Refresh();
    }
Esempio n. 25
0
        private bool CheckAlreadyAdded(PointObject po)
        {
            string strQuery = "";

            strQuery  = "SELECT COUNT(ID) FROM TblLog ";
            strQuery += String.Format("WHERE RegisterFiscalID = '{0}' AND ZNo = '{1}' AND DocumentNo = '{2}' AND Points = '{3}' ",
                                      po.RegisterFiscalID,
                                      po.ZNo,
                                      po.DocumentNo,
                                      po.Value
                                      );

            int count = (int)GetSqlDbValue(strQuery);

            return(count > 0);
        }
Esempio n. 26
0
    void ApplyVisibility()
    {
        if (worldTreeIndices.Count != visibility.Count)
        {
            DebugOutput.Shout("CATASTROPHE ApplyVisibility");
            return;
        }
        //DebugOutput.Shout(worldTreeIndices.Count.ToString());
        for (int i = 0; i < worldTreeIndices.Count; i++)
        {
            pointObject = worldTree.GetObjectAt(worldTreeIndices[i]);
            if (pointObject != null)
            {
                //pointObject.SetVisibility(visibility[i]);

            }
        }
    }
Esempio n. 27
0
        public static IPoint CreatePoint(object[] point)
        {
            IPoint result = null;

            if (point.Length == 3 || point.Length == 2)
            {
                PointObject po = new PointObject();
                po.X = double.Parse(point[0].ToString());
                po.Y = double.Parse(point[1].ToString());

                result = new PointClass();
                result.PutCoords(po.X, po.Y);
            }
            else
            {
                throw new Exception("点坐标串错误!");
            }

            return(result);
        }
Esempio n. 28
0
        public PointObjectForm()
        {
            InitializeComponent();

            // Initialize localization
            idHeader.Text    = Strings.ID;
            typeHeader.Text  = Strings.Type;
            mapIdHeader.Text = Strings.MapID;
            xPosHeader.Text  = Strings.XPos;
            yPosHeader.Text  = Strings.YPos;

            btnCreate.Text = Strings.Create;
            btnDelete.Text = Strings.Delete;
            btnEdit.Text   = Strings.Edit;

            foreach (var type in PointObject.ValidTypes)
            {
                var typeName = PointObject.GetTypeNameFromId(type);

                types.Add(typeName, type);
            }
        }
Esempio n. 29
0
        public static void TranslateAndRotate()
        {
            var sourceStart = GetPoint("\nPick source (Field) point. ");

            if (sourceStart == null)
            {
                return;
            }

            var sourceEnd = GetPoint("\nPick fixed destination (Record) point. ");

            if (sourceEnd == null)
            {
                return;
            }

            var desStart = GetPoint("\nPick fixed destination (Record) point. ");

            if (desStart == null)
            {
                return;
            }

            var desEnd = GetPoint("\nPick destination (Record) point. ");

            if (desEnd == null)
            {
                return;
            }

            var translationVector = sourceStart.Value.GetVectorTo(sourceEnd.Value);

            var picksetbefore = new PointObject(sourceStart.Value, sourceEnd.Value, desStart.Value, desEnd.Value);
            var picksetafter  = new PointObject(picksetbefore, translationVector);

            //CreatePickSetLines(picksetbefore);
            CreatePickSetLines(picksetafter);
            var vec1 = picksetafter.SouStart.GetVectorTo(picksetafter.SouEnd);
            var vec2 = picksetafter.DesStart.GetVectorTo(picksetafter.DesEnd);

            var ang = vec1.GetAngleTo(vec2) * 180.0 / Math.PI;

            var mat = Matrix3d.Rotation(vec1.GetAngleTo(vec2), new Vector3d(0, 0, 1), picksetafter.SouEnd);

            Program.CreatePoint(picksetafter.SouEnd.TransformBy(mat));
            Program.CreatePoint(picksetafter.DesEnd.TransformBy(mat));
            // move first point to second point

            //var start1 = new Point3d(1, 0, 0);
            //var end1   = new Point3d(2, 0, 0);

            //var start2 = new Point3d(1, 0, 0);
            //var end2   = new Point3d(2, 2, 0);

            //var vec1 = start1.GetVectorTo(end1);
            //var vec2 = start2.GetVectorTo(end2);

            //var ang = vec1.GetAngleTo(vec2) * 180.0 / Math.PI;

            //var mat = Matrix3d.Rotation(vec1.GetAngleTo(vec2), new Vector3d(0, 0, 1), start1);

            //Program.CreatePoint(start1);
            //Program.CreatePoint(start2);

            //Program.CreatePoint(end1);
            //Program.CreatePoint(end2);

            //Program.CreatePoint(start1.TransformBy(mat));
            //// Program.CreatePoint(start2.TransformBy(mat));
            //Program.CreatePoint(end1.TransformBy(mat));
            ////Program.CreatePoint(  end2.TransformBy(mat));

            //Program.CreateLine(start1, end1);
            //Program.CreateLine(start2, end2);
        }
Esempio n. 30
0
 private static void CreatePickSetLines(PointObject picksetbefore)
 {
     Program.CreateLine(picksetbefore.SouStart, picksetbefore.SouEnd);
     Program.CreateLine(picksetbefore.DesStart, picksetbefore.DesEnd);
 }
Esempio n. 31
0
    public PointObject GetSetPointObject(int typeID, Vector3 point)
    {
        if (typeID == 1)
        {
            EraseObject(point);
            return null;
        }
        int index = worldTree.GetIndexAtWorldPoint(point);
        PointObject po = worldTree.GetObjectAt(index);

        worldTree.SetValueAtIndex(index,(sbyte)typeID);
        GameManager.worldInterface.SetValue(point, (sbyte)typeID);

        if (po == null)
        {
            PointObjectPrefab poType = PointObjectPrefabCollection.GetPointObjectDataType(typeID);
            if (poType.baseElement)
            {
                //look for neighboring pointObjects
                Vector3 offset;
                for (int i = -1; i < 2; i++)
                {
                    for (int j = -1; j < 2; j++)
                    {
                        for (int k = -1; k < 2; k++)
                        {
                            offset = point;
                            offset.x += i;
                            offset.y += j;
                            offset.z += k;

                            if (offset != point)
                            {
                                po = worldTree.GetObjectAt(offset);

                                if (po != null && po.TypeID == typeID)
                                {
                                    if (!po.isFull())
                                    {
                                        po.AddSubPoint(point);
                                        goto AddedSub;
                                    }
                                }
                                else
                                {
                                    po = null;
                                }
                            }
                        }
                    }
                }
                if (po == null)
                {
                    po = new PointObject(typeID, point);
                }

            }
            else
            {
                po = new PointObject(typeID, point);

            }
            AddedSub:

            worldTree.SetObjectValue(index, po);
        }

        return po;
    }
Esempio n. 32
0
    protected virtual void SetPointObjectValue(Vector3 point, sbyte value)
    {
        int index = worldTree.GetIndexAtWorldPoint(point);
        if (worldTree.GetValueAt(index) == value)
        {
            return;
        }
        PointObject po = null;

        PointObjectPrefab poType = PointObjectPrefabCollection.GetPointObjectDataType(value);
        if (poType.baseElement)
        {
            //look for neighboring pointObjects
            Vector3 offset;
            for (int i = -1; i < 2; i++)
            {
                for (int j = -1; j < 2; j++)
                {
                    for (int k = -1; k < 2; k++)
                    {
                        offset = point;
                        offset.x += i;
                        offset.y += j;
                        offset.z += k;

                        if (offset != point)
                        {
                            int jndex = worldTree.GetIndexAtWorldPointSimple(offset);
                            if (worldTree.GetValueAt(jndex) == value)
                            {
                                po = worldTree.GetObjectAt(jndex);
                                if (!po.isFull())
                                {
                                    po.AddSubPoint(point);
                                    goto AddedSub;
                                }
                                else
                                {
                                    po = null;
                                }
                            }

                        }
                    }
                }
            }
            if (po == null)
            {
                po = new PointObject((int)value, point);
            }

        }
        else
        {
            po = new PointObject((int)value, point);

        }
        AddedSub:

        worldTree.SetObjectValue(index, po);
        worldTree.SetValueAtIndex(index, value);
    }
Esempio n. 33
0
    public void RequestNeighborCheck(PointObject pointObject,Vector3 point)
    {
        return;
        Vector3 offset;
        for (int i = 0; i < 6; i++)
        {
            offset = point;
            offset[(int)(i / 2)] += -1 + ((i % 2) * 2);  //sixaxis

            //int index = worldTree.GetIndexAtWorldPoint(offset);
            sbyte val = worldTree.GetValueAt(offset);
            if (val >= 1)
            {
                pointObject.NeighBorNotification(val, point, offset);
            }
        }
    }
Esempio n. 34
0
 public void SetObjectValue(Vector3 point, PointObject value)
 {
     SetObjectValue(GetIndexAtWorldPoint(point), value);
 }
Esempio n. 35
0
 public void ReplacingObject(PointObject replacement)
 {
     /*if (pointObjectBehaviour != null)
     {
         GameObject.Destroy(pointObjectBehaviour.gameObject);
     }*/
 }
Esempio n. 36
0
        public static IPolyline CreatePolyline(object[] paths)
        {
            IPolyline           result   = null;
            IGeometryCollection pGeomCol = new PolylineClass();
            object objMissing            = Type.Missing;

            foreach (object o in paths)//part
            {
                object[] ringpoints = o as object[];
                if (ringpoints != null)
                {
                    ISegmentCollection pSegCol = new PathClass();
                    ISegment           pSeg    = new LineClass();
                    IPoint             pFromPt = new PointClass();
                    IPoint             pToPt   = new PointClass();
                    IPoint             pEndPt  = new PointClass();

                    List <PointObject> poList = new List <PointObject>();
                    foreach (object po in ringpoints)
                    {
                        PointObject pObj  = new PointObject();
                        object[]    ptxya = po as object[];
                        if (ptxya != null)
                        {
                            if (ptxya.Length == 3)
                            {
                                pObj.X = double.Parse(ptxya[0].ToString());
                                pObj.Y = double.Parse(ptxya[1].ToString());
                                pObj.A = int.Parse(ptxya[2].ToString());
                            }
                            else if (ptxya.Length == 2)
                            {
                                pObj.X = double.Parse(ptxya[0].ToString());
                                pObj.Y = double.Parse(ptxya[1].ToString());
                                pObj.A = 0;
                            }
                            else
                            {
                                throw new Exception("坐标串输入错误!");
                            }
                            poList.Add(pObj);
                        }
                    }

                    if (poList.Count < 2)
                    {
                        throw new Exception("至少保证两个点来确定一条线!");
                    }

                    for (int i = 0; i < poList.Count - 1; i++)
                    {
                        if (poList[i].A.Equals(1))//处理狐段
                        {
                            PointObject poF = null;
                            PointObject poT = null;
                            PointObject poE = null;
                            if (i - 1 < 0)
                            {
                                poF = poList[poList.Count - 2];
                            }
                            else
                            {
                                poF = poList[i - 1];
                            }
                            poT = poList[i];
                            poE = poList[i + 1];

                            pFromPt.PutCoords(poF.X, poF.Y);
                            pToPt.PutCoords(poT.X, poT.Y);
                            pEndPt.PutCoords(poE.X, poE.Y);

                            //圆弧
                            ICircularArc          cirularArc           = new CircularArcClass();
                            IConstructCircularArc constructCircularArc = cirularArc as IConstructCircularArc;
                            constructCircularArc.ConstructThreePoints(pFromPt, pToPt, pEndPt, true);
                            pSeg = cirularArc as ISegment;
                            pSegCol.AddSegment(pSeg, ref objMissing, ref objMissing);
                        }
                        else
                        {
                            if (poList[i + 1].A.Equals(0))//处理直线,否则不处理
                            {
                                pFromPt.PutCoords(poList[i].X, poList[i].Y);
                                pToPt.PutCoords(poList[i + 1].X, poList[i + 1].Y);

                                pSeg           = new LineClass();
                                pSeg.FromPoint = pFromPt;
                                pSeg.ToPoint   = pToPt;
                                //一根线段
                                pSegCol.AddSegment(pSeg, ref objMissing, ref objMissing);
                            }
                        }
                    }

                    //一个part
                    pGeomCol.AddGeometry(pSegCol as IGeometry, ref objMissing, ref objMissing);
                }
            }

            result = pGeomCol as IPolyline;

            return(result);
        }
Esempio n. 37
0
 public static void SetPosition(PointObject po, Vector2 value)
 {
     Core.Operations.SetAnimableProperty.Perform(po, nameof(PointObject.Position), value, CoreUserPreferences.Instance.AutoKeyframes);
 }