internal static FeatureOperationsListResult DeserializeFeatureOperationsListResult(JsonElement element)
        {
            Optional <IReadOnlyList <FeatureData> > value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <FeatureData> array = new List <FeatureData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(FeatureData.DeserializeFeatureResult(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new FeatureOperationsListResult(Optional.ToList(value), nextLink.Value));
        }
Exemplo n.º 2
0
        private FeatureData GetFeatureData(GetFeatures getFeatures, FieldSelection fieldSelection)
        {
            CheckIsFeatureLayer();

            Features features = (Features)_service.Send(getFeatures);

            FeatureData featureData = fieldSelection.CreateFeatureData();

            featureData.LayerName = Name;
            LoadFeatureData(features, featureData, fieldSelection);

            if (features.FeatureCount.HasMore)
            {
                getFeatures.BeginRecord = 1;

                do
                {
                    getFeatures.BeginRecord += features.FeatureCount.Count;
                    features = (Features)_service.Send(getFeatures);
                    LoadFeatureData(features, featureData, fieldSelection);
                }while (features.FeatureCount.HasMore);
            }

            return(featureData);
        }
Exemplo n.º 3
0
 public void Dispose()
 {
     if (FeatureData != null)
     {
         FeatureData.Dispose();
     }
 }
Exemplo n.º 4
0
 public void Pack(Packer packer, SortedList <ushort, FeatureData> operationFeatures)
 {
     packer.Pack(TransactionId);
     if (_useFeatures)
     {
         FeatureData.PackMetaDataFeatures(packer, operationFeatures);
     }
 }
Exemplo n.º 5
0
 public void Unpack(Unpacker unpacker, SortedList <ushort, FeatureData> operationFeatures, HashSet <ushort> unknownFeatures)
 {
     TransactionId = unpacker.UnpackLong();
     if (_useFeatures)
     {
         FeatureData.UnpackMetaDataFeatures(unpacker, operationFeatures, unknownFeatures);
     }
 }
Exemplo n.º 6
0
    public void OnPreRender()
    {
      uint targetSize = 0;
      if (m_Camera.stereoEnabled)
      {
        // target size needs to be twice for single pass stereo
        targetSize = (uint)((UnityEngine.XR.XRSettings.eyeTextureWidth + 0 )<< 17) | (uint)m_Camera.pixelHeight;
      }
      else
      {
        targetSize = (uint)(m_Camera.pixelWidth << 16) | (uint)m_Camera.pixelHeight;
      }
      uint renderFeatures = UnityGetRenderFeatureState();
      if (m_TargetSize != targetSize || m_RenderFeatures != renderFeatures)
      {
        m_TargetSize = targetSize;
        m_RenderFeatures = renderFeatures;
        UpdateCommandBuffers();
      }
      
      if((renderFeatures & kPluginExtFeatureMRSActive) != 0)
      {
        if(!m_Camera.stereoEnabled)
        {
          // Allow UV clamping in desktop MRS to avoid artifacts along the edges in image effects.
          // In VR these potential artifacts affect only peripheral vision so they are unlikely to be noticed.
          FeatureData data = GetActiveFeatureData();
          Shader.SetGlobalVector("_PluginUVClamp", new Vector4(data.mrsLeft.MultiResUVClamp[0], data.mrsLeft.MultiResUVClamp[1], data.mrsLeft.MultiResUVClamp[2], data.mrsLeft.MultiResUVClamp[3]));
        }

        if(!NearlyEqual(m_MRSParameters.splitX,m_SplitX,0.01f) ||
           !NearlyEqual(m_MRSParameters.splitY,m_SplitY,0.01f) ||
           !NearlyEqual(m_MRSParameters.pixelDensity,m_PixelDensity,0.01f))
        {
          GL.Flush();
          m_MRSParameters.splitX = m_SplitX;
          m_MRSParameters.splitY = m_SplitY;
          m_MRSParameters.pixelDensity = m_PixelDensity;
          UnitySetMRSParameters(ref m_MRSParameters);
        }        
      }
      else
      {
        Shader.SetGlobalVector("_PluginUVClamp", new Vector4(0,0,1,1));    
      }

      if ((renderFeatures & kPluginExtFeatureSPSActive) != 0 || (renderFeatures & kPluginExtFeatureLMSActive) != 0)
      {
        // Right eye matrix
        Matrix4x4 clipRightX = m_Camera.GetStereoProjectionMatrix(Camera.StereoscopicEye.Right) * m_Camera.GetStereoViewMatrix(Camera.StereoscopicEye.Right);
        Shader.SetGlobalMatrix("_WorldToClipXRight", clipRightX);
      }

      Graphics.ExecuteCommandBuffer(m_CommandBuffer[(int)CB.kCB_BeforeEverything]);
    }
Exemplo n.º 7
0
        protected override void PrePack(Packer packer, int packerStartPosition)
        {
            base.PrePack(packer, packerStartPosition);

            packer.Pack(AccountId);
            packer.Pack(TargetChainId);

            if (HasFeatures)
            {
                FeatureData.PackTransactionFeatures(packer, _features);
            }
        }
Exemplo n.º 8
0
        public CombineFeature(FeatureData fd)
        {
            FeatureData = fd;

            var opts = GeneralLib.ToL(fd.StrData);

            CombineName = opts.First();
            var unitnames = opts.Skip(1).ToList();

            ConbineUnitName = unitnames.First();
            PartUnitNames   = unitnames.Skip(1).ToList();
        }
Exemplo n.º 9
0
        protected override void PreUnpack(Unpacker unpacker, int unpackerStartPosition)
        {
            base.PreUnpack(unpacker, unpackerStartPosition);

            AccountId     = unpacker.UnpackLong();
            TargetChainId = unpacker.UnpackInt();

            if (HasFeatures)
            {
                FeatureData.UnpackTransactionFeatures(unpacker, _features, _unkownFeatures);
            }
        }
Exemplo n.º 10
0
            public void AddData(string feature, TimeSpan timespan)
            {
                Total.Add(timespan);

                if (FeatureData.TryGetValue(feature, out Data data))
                {
                    data.Add(timespan);
                }
                else
                {
                    FeatureData.Add(feature, new Data(feature, timespan));
                }
            }
Exemplo n.º 11
0
        private FeatureData RecordSetToFeatureData(RecordSet recordSet, FieldSelection fieldSelection)
        {
            int fieldCount = fieldSelection.Fields.Count;

            int[] fieldIndex = new int[fieldCount];
            var   select     = recordSet.Fields.FieldArray.Select((field, index) => new { field, index });

            for (int i = 0; i < fieldCount; ++i)
            {
                var result = select.Where(x => String.Compare(x.field.Name, fieldSelection.Fields[i].Name, true) == 0).FirstOrDefault();
                fieldIndex[i] = result == null ? -1 : result.index;
            }

            FeatureData featureData = fieldSelection.CreateFeatureData();

            featureData.LayerName = Name;
            featureData.Rows      = new FeatureRow[recordSet.Records.Length];

            for (int r = 0; r < recordSet.Records.Length; ++r)
            {
                FeatureRow featureRow = new FeatureRow();
                featureRow.Values = new object[fieldCount];

                for (int c = 0; c < fieldSelection.Fields.Count; ++c)
                {
                    if (fieldIndex[c] >= 0)
                    {
                        object value = recordSet.Records[r].Values[fieldIndex[c]];

                        if (value != null)
                        {
                            if (fieldSelection.Fields[c].Type == CommonFieldType.Geometry)
                            {
                                featureRow.Values[c] = ((AppGeo.Clients.Ags.Proxy.Geometry)value).ToCommon();
                            }
                            else
                            {
                                featureRow.Values[c] = value;
                            }
                        }
                    }
                }

                featureData.Rows[r] = featureRow;
            }

            return(featureData);
        }
Exemplo n.º 12
0
        static void RegisterTest()
        {
            InitFRS();
            FeatureData fa = new FeatureData();

            fa.RegisterOneFinisedEvent += new FeatureData.RegisterOneFinisedCallback(RegisterOneFinised);
            Image    image    = Image.FromFile("G:/科研项目/新街口/三逃底库/NGL/njust14.jpg");
            UserInfo userinfo = new UserInfo();

            userinfo.cardId = "321342";

            userinfo.imgPath         = "G:/科研项目/新街口/三逃底库/NGL/njust14.jpg";
            userinfo.name            = "pkj";
            userinfo.gender          = "M";
            userinfo.type            = "2";
            userinfo.personDatasetId = 1;
            fa.Register(image, userinfo);
        }
Exemplo n.º 13
0
        static void RegisterTest()
        {
            InitFRS();
            FeatureData fa = new FeatureData();

            fa.RegisterOneFinisedEvent += new FeatureData.RegisterOneFinisedCallback(RegisterOneFinised);
            Image    image    = Image.FromFile("D:/3.jpg");
            UserInfo userinfo = new UserInfo();

            userinfo.cardId = "321342";

            userinfo.imgPath  = "D:/3.jpg";
            userinfo.name     = "sun";
            userinfo.gender   = "男";
            userinfo.peopleId = "1";
            userinfo.type     = "2";
            fa.Register(image, userinfo);
        }
Exemplo n.º 14
0
        static void bytetest()
        {
            InitFRS();
            FeatureData fa = new FeatureData();

            fa.LoadData(1);
            Bitmap bitmap = new Bitmap("D:\\test.jpg");

            byte[] b = BitmapToBytes(bitmap);
            Console.WriteLine(BitConverter.ToString(b));

            Bitmap Bitmapsrc = BytesToBitmap(b);

            Bitmapsrc.Save("D:\\test1.jpg");
            Bitmap bitmaptest = new Bitmap("D:\\test1.jpg");

            fa.LoadData(2);
            FRS.HitAlert[] hits = fa.Search(bitmaptest);

            Console.WriteLine(hits[0].Details[0].Score);
        }
Exemplo n.º 15
0
        protected void  InitFRS()
        {
            if (!IsInit)
            {
                fa = new FeatureData();
                var setting = new Model.Setting.SettingFRS();

                fa.MaxPersonNum              = setting.MaxPersonNum;
                fa.RegisterFaceHeightThresh  = setting.RegisterFaceHeightThresh;
                fa.RegisterFacePitchThresh   = setting.RegisterFacePitchThresh;
                fa.RegisterFaceQualityThresh = setting.RegisterFaceQualityThresh;
                fa.RegisterFaceRollThresh    = setting.RegisterFaceRollThresh;
                fa.RegisterFaceWidthThresh   = setting.RegisterFaceWidthThresh;
                fa.RegisterFaceYawThresh     = setting.RegisterFaceYawThresh;
                fa.ScoreThresh             = setting.ScoreThresh;
                fa.SearchFaceHeightThresh  = setting.SearchFacePitchThresh;
                fa.SearchFacePitchThresh   = setting.SearchFacePitchThresh;
                fa.SearchFaceQualityThresh = setting.SearchFaceQualityThresh;
                fa.SearchFaceRollThresh    = setting.SearchFaceRollThresh;
                fa.SearchFaceWidthThresh   = setting.SearchFaceWidthThresh;
                fa.SearchFaceYawThresh     = setting.SearchFaceYawThresh;
                fa.TopK = setting.TopK;

                cap = new Capture(fa);

                cap.Interval = setting.Interval;


                FRSParam param = new FRSParam();

                param.nMinFaceSize = Math.Min(setting.SearchFaceHeightThresh, setting.MaxPersonNum);

                param.nRollAngle  = Math.Min(setting.SearchFaceRollThresh, Math.Min(setting.SearchFaceYawThresh, setting.SearchFacePitchThresh));
                param.bOnlyDetect = true;

                FaceImage.Create(setting.ChannelNum, param);
                Feature.Init(setting.ChannelNum);
                IsInit = true;
            }
        }
Exemplo n.º 16
0
        static void SearchTest()
        {
            InitFRS();
            FeatureData fa = new FeatureData();

            fa.LoadData("hello");
            Image image = Image.FromFile("D:/Users/McLarry/Downloads/测试库3(IDCF)/测试库3(IDCF)/测试库/0b214fdcd6afb9d1d7683e72e0e81c21.jpg");

            HitAlert[] hits = fa.Search(image);
            Console.WriteLine("here" + hits.Length);
            //getPath("D:/Users/McLarry/Downloads/测试库1(101)/测试库1(100)/测试图像");
            //foreach (string filename in list)
            //{
            //    Console.WriteLine(filename);
            //    Image image = Image.FromFile(filename);
            //    Console.WriteLine("aaa");
            //    HitAlert[] hits = fa.Search(image);
            //    Console.WriteLine("bbb");
            //    //Console.WriteLine(hits[0].Details.Length);
            //    //Console.WriteLine(hits[0].Details[0].Score);
            //}
        }
Exemplo n.º 17
0
        static void SearchTest()
        {
            InitFRS();
            FeatureData fa = new FeatureData();

            fa.LoadData(1);
            Image image = Image.FromFile("G:/科研项目/新街口/三逃底库/NGL/njust14.jpg");

            HitAlert[] hits = fa.Search(image);
            Console.WriteLine("find result:" + hits.Length);
            //getPath("D:/Users/McLarry/Downloads/测试库1(101)/测试库1(100)/测试图像");
            //foreach (string filename in list)
            //{
            //    Console.WriteLine(filename);
            //    Image image = Image.FromFile(filename);
            //    Console.WriteLine("aaa");
            //    HitAlert[] hits = fa.Search(image);
            //    Console.WriteLine("bbb");
            //    //Console.WriteLine(hits[0].Details.Length);
            //    //Console.WriteLine(hits[0].Details[0].Score);
            //}
        }
Exemplo n.º 18
0
        public static int initFRS()
        {
            settingFRS = new Data.Setting.SettingFRS();

            selectedDevice = new Data.Device();

            FRSParam param = new FRSParam();

            param.nMinFaceSize = Math.Min(settingFRS.SearchFaceHeightThresh, settingFRS.MaxPersonNum);

            param.nRollAngle  = Math.Min(settingFRS.SearchFaceRollThresh, Math.Min(settingFRS.SearchFaceYawThresh, settingFRS.SearchFacePitchThresh));
            param.bOnlyDetect = true;

            FaceImage.Create(settingFRS.ChannelNum, param);
            Feature.Init(settingFRS.ChannelNum);
            fa = new FeatureData();
            fa.MaxPersonNum            = settingFRS.MaxPersonNum;
            fa.ScoreThresh             = settingFRS.ScoreThresh;
            fa.SearchFaceHeightThresh  = settingFRS.SearchFaceHeightThresh;
            fa.SearchFaceWidthThresh   = settingFRS.SearchFaceWidthThresh;
            fa.SearchFaceYawThresh     = settingFRS.SearchFaceYawThresh;
            fa.SearchFacePitchThresh   = settingFRS.SearchFacePitchThresh;
            fa.SearchFaceRollThresh    = settingFRS.SearchFaceRollThresh;
            fa.SearchFaceQualityThresh = settingFRS.SearchFaceQualityThresh;
            fa.TopK = settingFRS.TopK;

            fa.RegisterFaceHeightThresh  = settingFRS.RegisterFaceHeightThresh;
            fa.RegisterFaceWidthThresh   = settingFRS.RegisterFaceWidthThresh;
            fa.RegisterFaceYawThresh     = settingFRS.RegisterFaceYawThresh;
            fa.RegisterFacePitchThresh   = settingFRS.RegisterFacePitchThresh;
            fa.RegisterFaceRollThresh    = settingFRS.RegisterFaceRollThresh;
            fa.RegisterFaceQualityThresh = settingFRS.RegisterFaceQualityThresh;
            cap          = new Capture(fa);
            cap.Interval = settingFRS.Interval;

            return(0);
        }
Exemplo n.º 19
0
 private static extern void UnityGetFeatureData(ref FeatureData data);
Exemplo n.º 20
0
 public abstract (bool, int) Validate(Transaction transaction, FeatureData featureData);
Exemplo n.º 21
0
        //        // 特殊能力の名称(必要条件を満たさないものを含む)
        //        public string AllFeatureName(string Index)
        //        {
        //            string AllFeatureNameRet = default;
        //            AllFeatureNameRet = FeatureNameInt(Index, colAllFeature);
        //            return AllFeatureNameRet;
        //        }

        //        // 特殊能力のレベル(必要条件を満たさないものを含む)
        //        public double AllFeatureLevel(string Index)
        //        {
        //            double AllFeatureLevelRet = default;
        //            FeatureData fd;
        //            ;
        //#error Cannot convert OnErrorGoToStatementSyntax - see comment for details
        //            /* Cannot convert OnErrorGoToStatementSyntax, CONVERSION ERROR: Conversion for OnErrorGoToLabelStatement not implemented, please report this issue in 'On Error GoTo ErrorHandler' at character 36565


        //            Input:

        //                    On Error GoTo ErrorHandler

        //             */
        //            fd = (FeatureData)colAllFeature[Index];
        //            AllFeatureLevelRet = fd.Level;
        //            if (fd.Level == Constants.DEFAULT_LEVEL)
        //            {
        //                AllFeatureLevelRet = 1d;
        //            }

        //            return AllFeatureLevelRet;
        //        ErrorHandler:
        //            ;
        //            AllFeatureLevelRet = 0d;
        //        }

        //        // 特殊能力のレベルが指定されているか(必要条件を満たさないものを含む)
        //        public bool AllFeatureLevelSpecified(string Index)
        //        {
        //            bool AllFeatureLevelSpecifiedRet = default;
        //            FeatureData fd;
        //            ;
        //#error Cannot convert OnErrorGoToStatementSyntax - see comment for details
        //            /* Cannot convert OnErrorGoToStatementSyntax, CONVERSION ERROR: Conversion for OnErrorGoToLabelStatement not implemented, please report this issue in 'On Error GoTo ErrorHandler' at character 37017


        //            Input:

        //                    On Error GoTo ErrorHandler

        //             */
        //            fd = (FeatureData)colAllFeature[Index];
        //            if (fd.Level != Constants.DEFAULT_LEVEL)
        //            {
        //                AllFeatureLevelSpecifiedRet = true;
        //            }

        //            return AllFeatureLevelSpecifiedRet;
        //        ErrorHandler:
        //            ;
        //            AllFeatureLevelSpecifiedRet = false;
        //        }

        //        // 特殊能力のデータ(必要条件を満たさないものを含む)
        //        public string AllFeatureData(string Index)
        //        {
        //            string AllFeatureDataRet = default;
        //            FeatureData fd;
        //            ;
        //#error Cannot convert OnErrorGoToStatementSyntax - see comment for details
        //            /* Cannot convert OnErrorGoToStatementSyntax, CONVERSION ERROR: Conversion for OnErrorGoToLabelStatement not implemented, please report this issue in 'On Error GoTo ErrorHandler' at character 37422


        //            Input:

        //                    On Error GoTo ErrorHandler

        //             */
        //            fd = (FeatureData)colAllFeature[Index];
        //            AllFeatureDataRet = fd.StrData;
        //            return AllFeatureDataRet;
        //        ErrorHandler:
        //            ;
        //            AllFeatureDataRet = "";
        //        }

        //        // 特殊能力にレベル指定がされている?(必要条件を満たさないものを含む)
        //        public bool IsAllFeatureLevelSpecified(string Index)
        //        {
        //            bool IsAllFeatureLevelSpecifiedRet = default;
        //            FeatureData fd;
        //            ;
        //#error Cannot convert OnErrorGoToStatementSyntax - see comment for details
        //            /* Cannot convert OnErrorGoToStatementSyntax, CONVERSION ERROR: Conversion for OnErrorGoToLabelStatement not implemented, please report this issue in 'On Error GoTo ErrorHandler' at character 37760


        //            Input:

        //                    On Error GoTo ErrorHandler

        //             */
        //            fd = (FeatureData)colAllFeature[Index];
        //            if (fd.Level == Constants.DEFAULT_LEVEL)
        //            {
        //                IsAllFeatureLevelSpecifiedRet = false;
        //            }
        //            else
        //            {
        //                IsAllFeatureLevelSpecifiedRet = true;
        //            }

        //            return IsAllFeatureLevelSpecifiedRet;
        //        ErrorHandler:
        //            ;
        //            IsAllFeatureLevelSpecifiedRet = false;
        //        }

        // 特殊能力が必要条件を満たしているか
        public bool IsFeatureActivated(FeatureData fd)
        {
            // XXX 同一インスタンスじゃないかも
            return(AllFeatures.Contains(fd));
        }
Exemplo n.º 22
0
 public bool TryGetFeature(ushort featureId, out FeatureData featureData)
 {
     return(_features.TryGetValue(featureId, out featureData));
 }
        public static Hashtable FillFeatureCache(ITable inputSignsTable, int inFromIDFI, int inToIDFI,
                                                 IFeatureClass inputLineFeatures, string linesIDFieldName,
                                                 ITrackCancel trackcancel)
        {
            // make and fill a SortedList from the IDs referenced in the table

            // for MultiNet data, there is only one ID field, so its index will be
            // passed in as inFromIDFI, while -1 will be passed in to inToIDFI.

            SortedList IDs = new System.Collections.SortedList();

            ICursor inCursor = inputSignsTable.Search(null, true);
            IRow row;

            long fromID, toID;
            bool exists;
            int cancelCheckInterval = 100;

            if (inToIDFI == -1)
            {
                while ((row = inCursor.NextRow()) != null)
                {
                    fromID = Convert.ToInt64(row.get_Value(inFromIDFI));

                    exists = IDs.Contains(fromID);
                    if (!exists)
                        IDs.Add(fromID, fromID);
                }
            }
            else
            {
                while ((row = inCursor.NextRow()) != null)
                {
                    fromID = Convert.ToInt64(row.get_Value(inFromIDFI));
                    toID = Convert.ToInt64(row.get_Value(inToIDFI));

                    exists = IDs.Contains(fromID);
                    if (!exists)
                        IDs.Add(fromID, fromID);

                    exists = IDs.Contains(toID);
                    if (!exists)
                        IDs.Add(toID, toID);
                }
            }

            // make the query filter for fetching features

            IQueryFilter queryFilter = new QueryFilterClass();
            queryFilter.SubFields = "*";

            // Now fetch batches of features

            long currID;
            int numFeaturesPerQuery = 200;
            int numToFetch = IDs.Count;
            int totalRemaining, totalDone = 0;

            int linesIDFieldIndex = inputLineFeatures.FindField(linesIDFieldName);

            Hashtable outputFeatures = new System.Collections.Hashtable((int)numToFetch);

            if (numFeaturesPerQuery > numToFetch)
                numFeaturesPerQuery = numToFetch;

            while (totalDone < numToFetch)
            {
                // Populate the QueryDef Where clause IN() statement for the current batch of features.
                // This is going to be very slow unless linesIDFieldName is indexed and this is why
                // we added a warning to the GP message window if this is the case.  If you cannot
                // index linesIDFieldName, then this code would run faster scanning the whole feature
                // class looking for the records we need (no Where clause).

                string whereClause = linesIDFieldName + " IN(";

                for (int i = 0; i < numFeaturesPerQuery; i++)
                {
                    currID = Convert.ToInt64(IDs.GetByIndex(totalDone + i), System.Globalization.CultureInfo.InvariantCulture);
                    whereClause += Convert.ToString(currID, System.Globalization.CultureInfo.InvariantCulture);
                    if (i != (numFeaturesPerQuery - 1))
                        whereClause += ",";
                    else
                        whereClause += ")";
                }

                queryFilter.WhereClause = whereClause;

                // select the features

                IFeatureCursor inputFeatureCursor = inputLineFeatures.Search(queryFilter, false);

                // get the features

                IFeature feature;

                while ((feature = inputFeatureCursor.NextFeature()) != null)
                {
                    // keep a copy of the OID and shape of feature - skip records that cause errors
                    // (perhaps pass the GPMessages in and log warnings in there if you need to log exceptions)

                    try
                    {
                        FeatureData data = new FeatureData(feature.OID, feature.ShapeCopy);
                        outputFeatures.Add(Convert.ToInt64(feature.get_Value(linesIDFieldIndex)), data);
                    }
                    catch
                    {
                    }

                    if ((totalDone % cancelCheckInterval) == 0)
                    {
                        // check for user cancel

                        if (trackcancel != null && !trackcancel.Continue())
                            throw (new COMException("Function cancelled."));
                    }
                }

                // finished? set up for next batch

                totalDone += numFeaturesPerQuery;

                totalRemaining = numToFetch - totalDone;
                if (totalRemaining > 0)
                {
                    if (numFeaturesPerQuery > totalRemaining)
                        numFeaturesPerQuery = totalRemaining;
                }
            }

            return outputFeatures;
        }
Exemplo n.º 24
0
    // Process the skeleton data
    void ProcessSkeleton()
    {
        List <uint> lostUsers = new List <uint>();

        lostUsers.AddRange(allUsers);

        for (int i = 0; i < KinectWrapper.Constants.NuiSkeletonCount; i++)
        {
            KinectWrapper.NuiSkeletonData skeletonData = skeletonFrame.SkeletonData[i];
            uint userId = skeletonData.dwTrackingID;

            if (skeletonData.eTrackingState == KinectWrapper.NuiSkeletonTrackingState.SkeletonTracked)
            {
                if (!AllPlayersCalibrated)
                {
                    CalibrateUser(userId);
                }

                int stateNotTracked = (int)KinectWrapper.NuiSkeletonPositionTrackingState.NotTracked;

                if (userId == Player1ID)
                {
                    //Debug.Log("user yes:" + userId.ToString()); //Waterstrong
                    // get player position
                    player1Pos   = kinectToWorld.MultiplyPoint3x4(skeletonData.Position);
                    player1Pos.z = -player1Pos.z;

                    //Debug.Log(String.Format("({0}, {1}, {2})", player1Pos.x, player1Pos.y, player1Pos.z));
                    //CalibrationText.guiText.text = String.Format("({0:F1}, {1:F1}, {2:F1})", player1Pos.x, player1Pos.y, player1Pos.z);

                    // get joints rotation
                    for (int j = 0; j < (int)KinectWrapper.NuiSkeletonPositionIndex.Count; j++)
                    {
                        player1JointsTracked[j] = (int)skeletonData.eSkeletonPositionTrackingState[j] != stateNotTracked;

                        if (player1JointsTracked[j])
                        {
                            player1JointsPos[j]   = kinectToWorld.MultiplyPoint3x4(skeletonData.SkeletonPositions[j]);
                            player1JointsPos[j].z = -player1JointsPos[j].z;
                        }
                    }

                    // get joint orientations
                    KinectWrapper.GetSkeletonJointOrientation(ref player1JointsPos, ref player1JointsTracked, ref player1JointsOri);

                    // get player rotation
                    player1Ori = player1JointsOri[(int)KinectWrapper.NuiSkeletonPositionIndex.HipCenter];



                    // Waterstrong Add UI
                    //_adaptiveUi.SetUiCenter(player1JointsPos[(int)KinectWrapper.NuiSkeletonPositionIndex.Head], player1JointsPos[(int)KinectWrapper.NuiSkeletonPositionIndex.HandLeft], player1JointsPos[(int)KinectWrapper.NuiSkeletonPositionIndex.HandRight]);

                    // Waterstrong Add
                    FeatureData featureData = new FeatureData();
                    featureData.SetRelativeJoints(player1JointsPos);
                    MotionType mt = _motion.HandleDataEx(featureData);
                    switch (mt)
                    {
                    case MotionType.Jump:
                        Debug.Log("jump");
                        //SendMessage("DidJumpReachApex", SendMessageOptions.DontRequireReceiver);
                        break;

                    //case MotionType.Left:
                    //    Debug.Log("left");
                    //    break;
                    //case MotionType.Right:
                    //    Debug.Log("right");
                    //    break;
                    default: break;
                    }
                }
                else if (userId == Player2ID)
                {
                    // get player position
                    player2Pos   = kinectToWorld.MultiplyPoint3x4(skeletonData.Position);
                    player2Pos.z = -player2Pos.z;

                    // get joints rotation
                    for (int j = 0; j < (int)KinectWrapper.NuiSkeletonPositionIndex.Count; j++)
                    {
                        player2JointsTracked[j] = (int)skeletonData.eSkeletonPositionTrackingState[j] != stateNotTracked;

                        if (player2JointsTracked[j])
                        {
                            player2JointsPos[j]   = kinectToWorld.MultiplyPoint3x4(skeletonData.SkeletonPositions[j]);
                            player2JointsPos[j].z = -player2JointsPos[j].z;
                        }
                    }

                    // get joint orientations
                    KinectWrapper.GetSkeletonJointOrientation(ref player2JointsPos, ref player2JointsTracked, ref player2JointsOri);

                    // get player rotation
                    player2Ori = player2JointsOri[(int)KinectWrapper.NuiSkeletonPositionIndex.HipCenter];
                }

                lostUsers.Remove(userId);
            }
        }

        // remove the lost users if any
        if (lostUsers.Count > 0)
        {
            foreach (uint userId in lostUsers)
            {
                RemoveUser(userId);
            }

            lostUsers.Clear();
        }
    }
Exemplo n.º 25
0
 public CHCFaceDetecter(Capture cap, FeatureData featureData, System.Windows.Forms.PictureBox RealPlayWnd)
 {
     this.cap         = cap;
     this.featureData = featureData;
     this.RealPlayWnd = RealPlayWnd;
 }
        public static Hashtable FillFeatureCache(ITable inputSignsTable, int inFromIDFI, int inToIDFI,
                                                 IFeatureClass inputLineFeatures, string linesIDFieldName,
                                                 ITrackCancel trackcancel)
        {
            // make and fill a SortedList from the IDs referenced in the table

            // for MultiNet data, there is only one ID field, so its index will be
            // passed in as inFromIDFI, while -1 will be passed in to inToIDFI.

            SortedList IDs = new System.Collections.SortedList();

            ICursor inCursor = inputSignsTable.Search(null, true);
            IRow    row;

            long fromID, toID;
            bool exists;
            int  cancelCheckInterval = 100;

            if (inToIDFI == -1)
            {
                while ((row = inCursor.NextRow()) != null)
                {
                    fromID = Convert.ToInt64(row.get_Value(inFromIDFI));

                    exists = IDs.Contains(fromID);
                    if (!exists)
                    {
                        IDs.Add(fromID, fromID);
                    }
                }
            }
            else
            {
                while ((row = inCursor.NextRow()) != null)
                {
                    fromID = Convert.ToInt64(row.get_Value(inFromIDFI));
                    toID   = Convert.ToInt64(row.get_Value(inToIDFI));

                    exists = IDs.Contains(fromID);
                    if (!exists)
                    {
                        IDs.Add(fromID, fromID);
                    }

                    exists = IDs.Contains(toID);
                    if (!exists)
                    {
                        IDs.Add(toID, toID);
                    }
                }
            }

            // make the query filter for fetching features

            IQueryFilter queryFilter = new QueryFilterClass();

            queryFilter.SubFields = "*";

            // Now fetch batches of features

            long currID;
            int  numFeaturesPerQuery = 200;
            int  numToFetch = IDs.Count;
            int  totalRemaining, totalDone = 0;

            int linesIDFieldIndex = inputLineFeatures.FindField(linesIDFieldName);

            Hashtable outputFeatures = new System.Collections.Hashtable((int)numToFetch);

            if (numFeaturesPerQuery > numToFetch)
            {
                numFeaturesPerQuery = numToFetch;
            }

            while (totalDone < numToFetch)
            {
                // Populate the QueryDef Where clause IN() statement for the current batch of features.
                // This is going to be very slow unless linesIDFieldName is indexed and this is why
                // we added a warning to the GP message window if this is the case.  If you cannot
                // index linesIDFieldName, then this code would run faster scanning the whole feature
                // class looking for the records we need (no Where clause).

                string whereClause = linesIDFieldName + " IN(";

                for (int i = 0; i < numFeaturesPerQuery; i++)
                {
                    currID       = Convert.ToInt64(IDs.GetByIndex(totalDone + i), System.Globalization.CultureInfo.InvariantCulture);
                    whereClause += Convert.ToString(currID, System.Globalization.CultureInfo.InvariantCulture);
                    if (i != (numFeaturesPerQuery - 1))
                    {
                        whereClause += ",";
                    }
                    else
                    {
                        whereClause += ")";
                    }
                }

                queryFilter.WhereClause = whereClause;

                // select the features

                IFeatureCursor inputFeatureCursor = inputLineFeatures.Search(queryFilter, false);

                // get the features

                IFeature feature;

                while ((feature = inputFeatureCursor.NextFeature()) != null)
                {
                    // keep a copy of the OID and shape of feature - skip records that cause errors
                    // (perhaps pass the GPMessages in and log warnings in there if you need to log exceptions)

                    try
                    {
                        FeatureData data = new FeatureData(feature.OID, feature.ShapeCopy);
                        outputFeatures.Add(Convert.ToInt64(feature.get_Value(linesIDFieldIndex)), data);
                    }
                    catch
                    {
                    }

                    if ((totalDone % cancelCheckInterval) == 0)
                    {
                        // check for user cancel

                        if (trackcancel != null && !trackcancel.Continue())
                        {
                            throw (new COMException("Function cancelled."));
                        }
                    }
                }

                // finished? set up for next batch

                totalDone += numFeaturesPerQuery;

                totalRemaining = numToFetch - totalDone;
                if (totalRemaining > 0)
                {
                    if (numFeaturesPerQuery > totalRemaining)
                    {
                        numFeaturesPerQuery = totalRemaining;
                    }
                }
            }

            return(outputFeatures);
        }
Exemplo n.º 27
0
        protected override void Seed(CodeFighter.Data.CodeFighterContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            #region ACTIONS
            var repairPart = new ActionData()
            {
                Id = 1, Type = "RepairPart", Name = "Sheild Regeneration", Description = "Shields regenerate 2HP each round", TargetSelfPart = true, ActionValuesJSON = "{\"RepairAmount\":2}"
            };
            var repairShip = new ActionData()
            {
                Id = 2, Type = "RepairShip", Name = "Damage Control Teams", Description = "Damage Control teams repair the ship for 5HP per round", TargetSelfShip = true, ActionValuesJSON = "{\"RepairAmount\":5}"
            };

            context.ActionData.AddOrUpdate(x => x.Id,
                                           repairPart,
                                           repairShip
                                           );
            #endregion

            #region PARTS
            // weapons
            //** laser beam
            var laserBeam = new PartData()
            {
                Id = 1, Type = "Weapon", Name = "Laser Beam", Description = "Freaking Lasers", MaxHP = 1, DamageType = "Energy", FiringType = "Beam"
            };
            //** plasma cannon
            var plasmaCannon = new PartData()
            {
                Id = 2, Type = "Weapon", Name = "Plasma Cannon", Description = "BURNNNNN!", MaxHP = 1, DamageType = "Plasma", FiringType = "Cannon"
            };
            //** torpedo
            var torpedoLauncher = new PartData()
            {
                Id = 3, Type = "Weapon", Name = "Torpedo Launcher", Description = "All Tubes, Fire!", MaxHP = 1, DamageType = "Explosive", FiringType = "Launcher"
            };

            // defenses
            //** shield generator
            var shieldGenerator = new PartData()
            {
                Id = 4, Type = "Defense", Name = "Shield Generator", Description = "Regenerative Shielding", MaxHP = 15, DefenseType = "Shield", ActionData = new List <ActionData>()
                {
                    repairPart
                }
            };
            //** armor plate
            var armorPlate = new PartData()
            {
                Id = 5, Type = "Defense", Name = "Armor Plating", Description = "Reactive Armor", MaxHP = 15, DefenseType = "Armor"
            };
            //** point defense
            var pointDefense = new PartData()
            {
                Id = 8, Type = "Defense", Name = "Point Defense Pod", Description = "Close In Weapons System", MaxHP = 15, DefenseType = "PointDefense"
            };

            // actions
            //** damage control
            var damageControl = new PartData()
            {
                Id = 6, Type = "Action", Name = "Damage Control", Description = "Repair 5HP per round, 50% chance to repair a destroyed part", MaxHP = 1, ActionData = new List <ActionData>()
                {
                    repairShip
                }
            };

            // engines
            //** thruster
            var thruster = new PartData()
            {
                Id = 7, Type = "Engine", Name = "DU-1 Thruster", Description = "Make It Go Faster!", MaxHP = 1
            };

            context.PartData.AddOrUpdate(x => x.Id,
                                         laserBeam,
                                         plasmaCannon,
                                         torpedoLauncher,
                                         shieldGenerator,
                                         armorPlate,
                                         pointDefense,
                                         damageControl,
                                         thruster
                                         );
            #endregion

            #region SHIPHULLS
            var hullIowa = new ShipHullData()
            {
                Id = 1, ClassName = "Iowa", HullSize = "CO", MaxHitPoints = 40
            };
            var hullBunker = new ShipHullData()
            {
                Id = 2, ClassName = "Bunker", HullSize = "CO", MaxHitPoints = 40
            };

            context.ShipHullData.AddOrUpdate(x => x.Id,
                                             hullIowa,
                                             hullBunker
                                             );
            #endregion

            #region SHIPS
            var missouri = new ShipData()
            {
                Id       = 1,
                Name     = "UNSC Missouri",
                ShipHull = hullIowa
            };
            missouri.Parts = new List <ShipPartData>()
            {
                new ShipPartData()
                {
                    Id = 1, PartData = laserBeam, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 2, PartData = laserBeam, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 3, PartData = plasmaCannon, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 4, PartData = torpedoLauncher, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 5, PartData = shieldGenerator, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 6, PartData = shieldGenerator, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 7, PartData = armorPlate, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 8, PartData = damageControl, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 9, PartData = thruster, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 10, PartData = thruster, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 11, PartData = thruster, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 12, PartData = thruster, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 13, PartData = thruster, ShipData = missouri
                },
                new ShipPartData()
                {
                    Id = 14, PartData = thruster, ShipData = missouri
                }
            };
            var alpha = new ShipData()
            {
                Id       = 2,
                Name     = "Alpha-01",
                ShipHull = hullBunker
            };
            alpha.Parts = new List <ShipPartData>()
            {
                new ShipPartData()
                {
                    Id = 15, PartData = laserBeam, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 16, PartData = laserBeam, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 17, PartData = plasmaCannon, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 18, PartData = torpedoLauncher, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 19, PartData = shieldGenerator, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 20, PartData = shieldGenerator, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 21, PartData = armorPlate, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 22, PartData = damageControl, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 23, PartData = thruster, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 24, PartData = thruster, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 25, PartData = thruster, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 26, PartData = thruster, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 27, PartData = thruster, ShipData = alpha
                },
                new ShipPartData()
                {
                    Id = 28, PartData = thruster, ShipData = alpha
                }
            };

            context.ShipData.AddOrUpdate(x => x.Id,
                                         missouri,
                                         alpha
                                         );
            #endregion

            #region FEATURES
            var asteroid = new FeatureData()
            {
                Id = 1, Name = "Asteroid", IsBlocking = true, Type = "asteroid"
            };

            context.FeatureData.AddOrUpdate(x => x.Id,
                                            asteroid);
            #endregion

            #region SCENARIOS
            var scenario = new ScenarioData()
            {
                Id = 1, ScenarioGUID = new Guid("508E62F3-5B0E-4716-8B8D-FBCA000317A2"), Name = "One on One", Description = "1v1 fight to the death in an asteroid field", RoundLimit = 30
            };

            context.ScenarioData.AddOrUpdate(x => x.Id,
                                             scenario
                                             );
            #endregion

            #region SCENARIOSHIPS
            context.ScenarioShipData.AddOrUpdate(x => x.Id,
                                                 new ScenarioShipData()
            {
                Id = 1, StartingPositionX = 5, StartingPositionY = 5, ShipName = "UNSC Missouri", IsPlayer = true, Ship = missouri, Scenario = scenario
            },
                                                 new ScenarioShipData()
            {
                Id = 2, StartingPositionX = 20, StartingPositionY = 20, ShipName = "Alpha-01", IsPlayer = false, Ship = alpha, Scenario = scenario
            }
                                                 );
            #endregion

            #region SCENARIOFEATURES
            context.ScenarioFeatureData.AddOrUpdate(x => x.Id,
                                                    new ScenarioFeatureData()
            {
                Id = 1, PositionX = 0, PositionY = 0, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 2, PositionX = 0, PositionY = 2, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 3, PositionX = 0, PositionY = 4, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 4, PositionX = 0, PositionY = 22, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 5, PositionX = 1, PositionY = 10, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 6, PositionX = 1, PositionY = 11, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 7, PositionX = 2, PositionY = 17, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 8, PositionX = 2, PositionY = 20, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 9, PositionX = 2, PositionY = 22, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 10, PositionX = 3, PositionY = 1, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 11, PositionX = 3, PositionY = 7, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 12, PositionX = 4, PositionY = 1, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 13, PositionX = 4, PositionY = 2, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 14, PositionX = 4, PositionY = 4, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 15, PositionX = 5, PositionY = 0, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 16, PositionX = 5, PositionY = 6, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 17, PositionX = 5, PositionY = 13, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 18, PositionX = 6, PositionY = 0, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 19, PositionX = 7, PositionY = 1, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 20, PositionX = 7, PositionY = 5, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 21, PositionX = 7, PositionY = 11, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 22, PositionX = 7, PositionY = 20, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 23, PositionX = 8, PositionY = 1, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 24, PositionX = 8, PositionY = 2, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 25, PositionX = 8, PositionY = 16, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 26, PositionX = 9, PositionY = 2, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 27, PositionX = 9, PositionY = 7, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 28, PositionX = 9, PositionY = 18, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 29, PositionX = 10, PositionY = 5, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 30, PositionX = 10, PositionY = 8, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 31, PositionX = 10, PositionY = 15, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 32, PositionX = 10, PositionY = 18, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 33, PositionX = 10, PositionY = 19, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 34, PositionX = 11, PositionY = 5, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 35, PositionX = 12, PositionY = 0, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 36, PositionX = 12, PositionY = 5, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 37, PositionX = 12, PositionY = 10, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 38, PositionX = 12, PositionY = 11, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 39, PositionX = 13, PositionY = 3, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 40, PositionX = 14, PositionY = 23, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 41, PositionX = 15, PositionY = 0, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 42, PositionX = 15, PositionY = 2, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 43, PositionX = 15, PositionY = 7, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 44, PositionX = 15, PositionY = 14, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 45, PositionX = 16, PositionY = 7, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 46, PositionX = 17, PositionY = 6, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 47, PositionX = 17, PositionY = 9, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 48, PositionX = 17, PositionY = 15, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 49, PositionX = 18, PositionY = 15, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 50, PositionX = 18, PositionY = 23, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 51, PositionX = 19, PositionY = 5, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 52, PositionX = 19, PositionY = 6, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 53, PositionX = 19, PositionY = 9, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 54, PositionX = 19, PositionY = 10, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 55, PositionX = 19, PositionY = 21, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 56, PositionX = 20, PositionY = 0, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 57, PositionX = 20, PositionY = 10, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 58, PositionX = 20, PositionY = 24, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 59, PositionX = 21, PositionY = 11, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 60, PositionX = 21, PositionY = 18, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 61, PositionX = 22, PositionY = 2, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 62, PositionX = 22, PositionY = 3, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 63, PositionX = 22, PositionY = 23, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 64, PositionX = 22, PositionY = 24, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 65, PositionX = 23, PositionY = 4, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 66, PositionX = 23, PositionY = 13, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 67, PositionX = 23, PositionY = 16, Feature = asteroid, Scenario = scenario
            },
                                                    new ScenarioFeatureData()
            {
                Id = 68, PositionX = 24, PositionY = 3, Feature = asteroid, Scenario = scenario
            }
                                                    );
            #endregion

            #region PLAYERS
            context.PlayerData.AddOrUpdate(x => x.Id,
                                           new PlayerData()
            {
                Id = 1, PlayerGUID = new Guid("550D672D-F40A-4A13-9212-DEB4CFE27F2D"), Name = "ArenaDave"
            });
            #endregion
        }
Exemplo n.º 28
0
    /// <summary>
    /// Selects the gameObject in an appropriate manner, deselecting the current gameObject in
    /// certain circumstances, reverting to the party leader.
    /// </summary>
    public void Select()
    {
        // Early out if already selected or if target cannot be selected
        if (transform == cameraController.selection || !canSelect)
        {
            return;
        }

        // ==========
        // What type of object is being selected?

        // Is this a party member?
        actor             = GetComponent <ActorData> ();
        targetPartyMember = GetComponent <PartyMember> ();
        Debug.Log(actor);
        Debug.Log(targetPartyMember);
        if (actor && targetPartyMember)
        {
            PartyMember currentPartyMember = cameraController.selection.GetComponent <PartyMember> ();

            // Only select the targeted party member if the current one is not receiving orders
            if (!currentPartyMember.isReceivingOrders)
            {
                cameraController.selection = transform;
            }
            else
            {
                Debug.Log("Finalize orders for " + cameraController.selection.gameObject + " first!");
            }
        }
        else
        {
            Debug.Log(gameObject + " is not an actor!");

            // Is this an item?
            item = GetComponent <ItemData> ();
            if (item)
            {
                // ---
                // TODO: Figure out what happens when you click an item.
                // ---
                Debug.Log("Item: " + item + " selected");
            }
            else
            {
                Debug.Log(gameObject + " is not an item!");

                // Is this a feature?
                feature = GetComponent <FeatureData> ();
                if (feature)
                {
                    // ---
                    // TODO: Figure out what happens when you click a feature.
                    // ---
                    Debug.Log("Feature: " + feature + " selected");
                }
                else
                {
                    Debug.Log(gameObject + " is not a feature!");
                    Debug.Log("Nothing selected!  !?Why is a selection on this gameObject!?");
                }
            }
        }
        // ==========
    }
Exemplo n.º 29
0
        private void LoadFeatureData(Features features, FeatureData featureData, FieldSelection fieldSelection)
        {
            if (features.Count == 0)
            {
                return;
            }

            int[] fieldIndex = new int[fieldSelection.Fields.Count];
            var   select     = features[0].Fields.Select((field, index) => new { field, index });

            for (int i = 0; i < fieldSelection.Fields.Count; ++i)
            {
                var result = select.Where(x => String.Compare(x.field.Name, fieldSelection.Fields[i].Name, true) == 0).FirstOrDefault();
                fieldIndex[i] = result == null ? -1 : result.index;
            }

            int offset = 0;

            if (featureData.Rows == null)
            {
                featureData.Rows = new FeatureRow[features.Count];
            }
            else
            {
                offset = featureData.Rows.Length;
                Array.Resize(ref featureData.Rows, offset + features.Count);
            }

            for (int r = 0; r < features.Count; ++r)
            {
                FeatureRow featureRow = new FeatureRow();
                featureRow.Values = new object[fieldSelection.Fields.Count];

                for (int c = 0; c < fieldSelection.Fields.Count; ++c)
                {
                    if (fieldIndex[c] >= 0)
                    {
                        string value = features[r].Fields[fieldIndex[c]].Value;

                        if (!String.IsNullOrEmpty(value) || features[r].Shape != null)
                        {
                            switch (fieldSelection.Fields[c].Type)
                            {
                            case CommonFieldType.Geometry:
                                if (features[r].Shape.OgcGeometryType == OgcGeometryType.MultiPoint && fieldSelection.Fields[c].GeometryType == OgcGeometryType.Point)
                                {
                                    featureRow.Values[c] = ((IMultiPoint)features[r].Shape)[0];
                                }
                                else
                                {
                                    featureRow.Values[c] = features[r].Shape;
                                }
                                break;

                            case CommonFieldType.Date:
                                featureRow.Values[c] = new DateTime((Convert.ToInt64(value) * 10000) + 621355968000000000);
                                break;

                            default:
                                featureRow.Values[c] = Convert.ChangeType(value, fieldSelection.Fields[c].DataType);
                                break;
                            }
                        }
                    }
                }

                featureData.Rows[r + offset] = featureRow;
            }
        }
Exemplo n.º 30
0
        private Dictionary<string, string> GetFeatureOptions(FeatureData data)
        {
            var options = new Dictionary<string, string>();

            if (data.PropertyName != null)
            {
                options.Add(data.PropertyName, data.PropertyValues);
            }

            return options;
        }
Exemplo n.º 31
0
 public void Dispose()
 {
     FeatureData?.Dispose();
 }
Exemplo n.º 32
0
    private void MotionRecognition()
    {
        if (nuiElementPress.IsGestureCtrolling)
        {
            return;
        }

        if (handWave.Recognise(sw, player))
        {
            nuiElementPress.OnSwitchInteractionPress();
        }

        FeatureData feature = new FeatureData();

        feature.SetRelativeJoints(sw.rawBonePos, player);

        MotionType mt = motion.HandleDataEx(feature);

        switch (mt)
        {
        case MotionType.None:
            break;

        case MotionType.Jump:     // 起跳
            nuiElementPress.TurnOver(1);
            Debug.Log("Jump");
            break;

        case MotionType.HandLeftSlide:     // 左滑动
            Debug.Log("LeftSlide");
            nuiElementPress.Rotate(1);
            break;

        case MotionType.HandRightSlide:     // 右滑动
            Debug.Log("RightSlide");
            nuiElementPress.Rotate(-1);
            break;

        case MotionType.HandsUp:     // 举手
            Debug.Log("HandsUp");
            break;

        case MotionType.HandsMiddle:     // 双手水平展开
            //promptUiCtrl.Show("双手水平展开");
            nuiElementPress.Zoom(1);
            Debug.Log("HandsMiddle");
            break;

        case MotionType.HandsFold:     // 双手水平收缩
            //promptUiCtrl.Show("双手水平收缩");
            nuiElementPress.Zoom(-1);
            Debug.Log("HandsFold");
            break;

        case MotionType.HandLeftUp:     // 左手向上
            nuiElementPress.TurnOver(-1);
            break;

        case MotionType.HandRightUp:     // 右手向上
            Debug.Log("Hand L&R Up");
            nuiElementPress.StopRotate();
            break;

        case MotionType.HandLeftCircle:     // 左手划圆
        case MotionType.HandRightCircle:    // 右手划圆
            nuiElementPress.OnSwitchInteractionPress();
            Debug.Log("HandRightCircle");
            break;

        case MotionType.HandLeftDown:
            Debug.Log("HandLeftDown");
            break;

        case MotionType.HandRightDown:
            Debug.Log("HandRightDown");
            break;

        default:
            break;
        }
    }