public XmlFormatterFeature(IProjectService projectService, FeatureSet featureSet)
     : base(projectService,
           new IFeatureItem[]
           {
               new FeatureItem(
                   "None",
                   "Removes the XML formatter.",
                   featureSet == FeatureSet.Mvc6 ? 1 : 3)
               {
                   IsSelected = featureSet == FeatureSet.Mvc6
               },
               new FeatureItem(
                   "DataContractSerializer",
                   "Include an XML input and output formatter using the DataContractSerializer.",
                   featureSet == FeatureSet.Mvc6 ? 2 : 1)
               {
                   IsSelected = featureSet == FeatureSet.Mvc6Api
               },
               new FeatureItem(
                   "XmlSerializer",
                   "Include an XML input and output formatter using the XmlSerializer.",
                   featureSet == FeatureSet.Mvc6 ? 3 : 2),
               
           })
 {
 }
Example #2
0
        public FeatureSet GetFeatures(int targetBin, DataReader.FrameType frameType)
        {
            List<IntensityPoint> intensityPointList = _uimfUtil.GetXic(targetBin, frameType);
            var features = new FeatureSet(intensityPointList);

            return features;
        }
        public XmlFormatterFeature(IProjectService projectService, FeatureSet featureSet)
            : base(projectService)
        {
            this.none = new FeatureItem(
                "None",
                "None",
                "Removes the XML formatter.",
                featureSet == FeatureSet.Mvc6 ? 1 : 3)
            {
                IsSelected = featureSet == FeatureSet.Mvc6
            };
            this.Items.Add(none);

            this.dataContractSerializer = new FeatureItem(
                "DataContractSerializer",
                "DataContractSerializer",
                "Include an XML input and output formatter using the DataContractSerializer.",
                featureSet == FeatureSet.Mvc6 ? 2 : 1)
            {
                IsSelected = featureSet == FeatureSet.Mvc6Api
            };
            this.Items.Add(dataContractSerializer);

            this.xmlSerializer = new FeatureItem(
                "XmlSerializer",
                "XmlSerializer",
                "Include an XML input and output formatter using the XmlSerializer.",
                featureSet == FeatureSet.Mvc6 ? 3 : 2);
            this.Items.Add(xmlSerializer);
        }
Example #4
0
 static void CovertFeatureFile(string featureFile, string mmFile)
 {
     FeatureSet featureSet = new FeatureSet();
     featureSet.Load(featureFile);
     XmlDocument xmlDoc = featureSet.ToXmlDocument();
     xmlDoc.Save(mmFile);
 }
        private static IContainer CreateContainer(string projectFilePath, FeatureSet featureSet)
        {
            ContainerBuilder builder = new ContainerBuilder();

            // Features
            builder.Register(x => featureSet);
            RegisterFeatures(builder, featureSet);

            // Services
            builder.RegisterType<FileSystemService>().As<IFileSystemService>().SingleInstance();
            builder.RegisterType<PortService>().As<IPortService>().SingleInstance();
            builder.RegisterType<ProjectService>()
                .As<IProjectService>()
                .WithParameter("projectFilePath", projectFilePath)
                .SingleInstance();

            // View Models
            builder.RegisterType<MainViewModel>().As<IMainViewModel>().SingleInstance();

            // Views
            builder.RegisterType<MainView>()
                .As<IMainView>()
                .PropertiesAutowired(PropertyWiringOptions.None)
                .SingleInstance();

            return builder.Build();
        }
 public BsonFormatterFeature(IProjectService projectService, FeatureSet featureSet)
     : base(projectService,
           new IFeatureItem[]
           {
               new FeatureItem(
                   "None",
                   "Removes the BSON formatter.",
                   featureSet == FeatureSet.Mvc6 ? 1 : 3)
               {
                   IsSelected = featureSet == FeatureSet.Mvc6
               },
               new FeatureItem(
                   "Camel-Case (e.g. camelCase)",
                   "The first character of the variable starts with a lower-case. Each word in the variable name after that starts with an upper-case character.",
                   featureSet == FeatureSet.Mvc6 ? 2 : 1)
               {
                   IsSelected = featureSet == FeatureSet.Mvc6Api
               },
               new FeatureItem(
                   "Title Case (e.g. TitleCase)",
                   "Each word in the variable name starts with an upper-case character.",
                   featureSet == FeatureSet.Mvc6 ? 3 : 2)
           })
 {
 }
Example #7
0
        public override bool Accept(FeatureSet FeatureSet, int Index)
        {
            double x = (double) FeatureSet.KeyPoints[Index].Point.X;
            double y = (double) FeatureSet.KeyPoints[Index].Point.Y;

            return (x > Position.x - Scale.x * 0.5 && x < Position.x + Scale.x * 0.5 && y > Position.y - Scale.y * 0.5 && y < Position.y + Scale.y * 0.5);
        }
Example #8
0
        public FeatureSet GetFeatures(double mz, Tolerance tolerance, DataReader.FrameType frameType)
        {
            var intensityBlock = _uimfUtil.GetXic(mz, tolerance.GetValue(), frameType, 
                tolerance.GetUnit() == ToleranceUnit.Ppm ? DataReader.ToleranceType.PPM : DataReader.ToleranceType.Thomson);
            var features = new FeatureSet(intensityBlock);

            return features;
        }
 IList<FeatureSet> IDataFeatureProvider.GetAllItems()
 {
     var result = new FeatureSet[indexes.Count];
     for (int idx = 0; idx < indexes.Count; idx++)
     {
         result[idx] = BaseProvider[indexes[idx]];
     }
     return result;
 }
 IList<FeatureSet> IDataFeatureProvider.GetItems(int index, int count)
 {
     var result = new FeatureSet[count];
     for (int idx = 0; idx < count; idx++)
     {
         result[idx] = BaseProvider[indexes[idx + index]];
     }
     return result;
 }
Example #11
0
 private static void RemoveNonFeature(ref TLSimilarityMatrix sims, FeatureSet set, Dictionary<int, string> qmap)
 {
     TLSimilarityMatrix target = new TLSimilarityMatrix();
     string feature = GetFeatureSetType(set);
     foreach (TLSingleLink link in sims.AllLinks)
     {
         if (qmap[Convert.ToInt32(link.SourceArtifactId)] == feature)
         {
             target.AddLink(link.SourceArtifactId, link.TargetArtifactId, link.Score);
         }
     }
     sims = target;
 }
Example #12
0
 static void ConvertFeatureFolder(string featuresFolder, string mmFile)
 {
     string[] files = Directory.GetFiles(featuresFolder, "*.feature", SearchOption.AllDirectories);
     FeatureSet featureSet = new FeatureSet();
     foreach (string file in files)
     {
         FeatureSet temp = new FeatureSet();
         temp.Load(file);
         featureSet.Merge(temp);
     }
     XmlDocument xmlDoc = featureSet.ToXmlDocument();
     xmlDoc.Save(mmFile);
 }
Example #13
0
        public void FilePathTest2()
        {
            FeatureSet target = new FeatureSet();
            string relativeFilePath = @"..\..\states.shp";
            string expectedFullPath = Path.GetFullPath(relativeFilePath);

            string actualFilePath;
            target.FilePath = relativeFilePath;
            actualFilePath = target.FilePath;
            Assert.AreEqual(relativeFilePath, actualFilePath);

            string actualFileName = target.Filename;
            Assert.AreEqual(expectedFullPath, actualFileName);
        }
Example #14
0
        public void FilePathTest1()
        {
            FeatureSet target = new FeatureSet();
            string relativeFilePath = @"inner\states.shp";
            string expectedFullPath = Path.Combine(Directory.GetCurrentDirectory(),relativeFilePath);

            string actualFilePath;
            target.FilePath = relativeFilePath;
            actualFilePath = target.FilePath;
            Assert.AreEqual(relativeFilePath, actualFilePath);

            string actualFileName = target.Filename;
            Assert.AreEqual(expectedFullPath, actualFileName);
        }
Example #15
0
        public void Add_MustNotReplaceFeatureRow()
        {
            var parent = new FeatureSet(FeatureType.Point);
            var target = parent.Features;
            DataRow expected = null;
            target.FeatureAdded += delegate(object sender, FeatureEventArgs args)
                                       {
                                           expected = args.Feature.DataRow;
                                       };

            var addedFeature = parent.AddFeature(new Point());
            var actual = addedFeature.DataRow;

            Assert.AreEqual(expected, actual);
        }
Example #16
0
        public void FilePathTestWithSpaces()
        {
            FeatureSet target = new FeatureSet();
            string relPath1 = @"folder";
            string relPath2 = @"name\states.shp";
            string relativeFilePath = relPath1 + " " +  relPath2;
            string expectedFullPath = Path.Combine(Directory.GetCurrentDirectory(), relPath1) +
                                      " " + relPath2;
            string actualFilePath;
            target.FilePath = relativeFilePath;
            actualFilePath = target.FilePath;
            Assert.AreEqual(relativeFilePath, actualFilePath);

            string actualFileName = target.Filename;
            Assert.AreEqual(expectedFullPath, actualFileName);
        }
Example #17
0
        public void FilePathTestWithSpaces()
        {
            FeatureSet target = new FeatureSet();
            // this path must exist.
            Directory.SetCurrentDirectory("C:\\Windows\\system32");
            // this path does need to actually exist.
            string expectedFullPath = @"C:\Windows\system32\folder name\states.shp";
            string relativeFilePath = @"folder name\states.shp";

            string actualFilePath;
            target.FilePath = relativeFilePath;
            actualFilePath = target.FilePath;
            Assert.AreEqual(relativeFilePath, actualFilePath);

            string actualFileName = target.Filename;
            Assert.AreEqual(expectedFullPath, actualFileName);
        }
        private static void RegisterFeatures(ContainerBuilder builder, FeatureSet featureSet)
        {
            // Hidden
            builder.RegisterType<SetRandomPortsFeature>().As<IFeature>().SingleInstance();

            if (featureSet == FeatureSet.Mvc6)
            {
                // CSS and JavaScript
                builder.RegisterType<FrontEndFrameworkFeature>().As<IFeature>().SingleInstance();
                builder.RegisterType<TypeScriptFeature>().As<IFeature>().SingleInstance();
                builder.RegisterType<JavaScriptTestFrameworkFeature>().As<IFeature>().SingleInstance();
            }

            if (featureSet == FeatureSet.Mvc6Api)
            {
                // Rest
                builder.RegisterType<SwaggerFeature>().As<IFeature>().SingleInstance();
            }

            // Formatters
            builder.RegisterType<JsonSerializerSettingsFeature>().As<IFeature>().SingleInstance();
            builder.RegisterType<BsonFormatterFeature>().As<IFeature>().SingleInstance();
            builder.RegisterType<XmlFormatterFeature>().As<IFeature>().SingleInstance();
            if (featureSet == FeatureSet.Mvc6Api)
            {
                builder.RegisterType<NoContentFormatterFeature>().As<IFeature>().SingleInstance();
                builder.RegisterType<NotAcceptableFormatterFeature>().As<IFeature>().SingleInstance();
            }

            // Security
            builder.RegisterType<HttpsEverywhereFeature>().As<IFeature>().SingleInstance();

            if (featureSet == FeatureSet.Mvc6)
            {
                // Social
                // builder.RegisterType<OpenGraphFeature>().As<IFeature>().SingleInstance();
                // builder.RegisterType<TwitterCardFeature>().As<IFeature>().SingleInstance();
            }

            if (featureSet == FeatureSet.Mvc6)
            {
                // Other
                builder.RegisterType<HumansTextFeature>().As<IFeature>().SingleInstance();
            }
        }
        private static IFeatureSet GetOrCreateFeaturesFromItems(IDictionary items)
        {
            IFeatureSet features;
            lock (mLock)
            {
                if (items.Contains(FEATURE_BUNDLE_KEY))
                {
                    features = (IFeatureSet)items[FEATURE_BUNDLE_KEY];
                }
                else
                {
                    features = new FeatureSet();
                    items.Add(FEATURE_BUNDLE_KEY, features);
                }
            }

            return features;
        }
Example #20
0
        public static TLSimilarityMatrix Extract(ref TLSimilarityMatrix sims, string tracedir, FeatureSet set, Dictionary<int, string> qmap)
        {
            TLSimilarityMatrix newsims = new TLSimilarityMatrix();

            if (set == FeatureSet.All)
            {
                ExtractFeature(ref sims, ref newsims, tracedir + @"\" + GetFeatureSetDir(FeatureSet.Bugs) + "\\");
                ExtractFeature(ref sims, ref newsims, tracedir + @"\" + GetFeatureSetDir(FeatureSet.Features) + "\\");
                ExtractFeature(ref sims, ref newsims, tracedir + @"\" + GetFeatureSetDir(FeatureSet.Patch) + "\\");
            }
            else
            {
                RemoveNonFeature(ref sims, set, qmap);
                ExtractFeature(ref sims, ref newsims, tracedir + GetFeatureSetDir(set) + "\\");
            }

            return newsims;
        }
        private static void RegisterFeatures(ContainerBuilder builder, FeatureSet featureSet)
        {
            if (featureSet == FeatureSet.Mvc6)
            {
                // CSS and JavaScript
                builder.RegisterType<FrontEndFrameworkFeature>().As<IFeature>().SingleInstance();
            }

            // Formatters
            builder.RegisterType<JsonFormatterFeature>().As<IFeature>().SingleInstance();
            builder.RegisterType<BsonFormatterFeature>().As<IFeature>().SingleInstance();
            builder.RegisterType<XmlFormatterFeature>().As<IFeature>().SingleInstance();

            if (featureSet == FeatureSet.Mvc6)
            {
                // Other
                builder.RegisterType<HumansTextFeature>().As<IFeature>().SingleInstance();
            }
        }
        public XmlFormatterFeature(IProjectService projectService, FeatureSet featureSet)
            : base(projectService)
        {
            this.featureSet = featureSet;

            this.none = new FeatureItem(
                "None", 
                "None", 
                "No Xml Formatter", 
                1)
            {
                IsSelected = featureSet == FeatureSet.Mvc6
            };
            this.Items.Add(this.none);

            this.dataContractSerializer = new FeatureItem(
                "DataContractSerializer",
                "DataContractSerializer",
                "Add the DataContractSerializer based input and output formatters.",
                2)
            {
                IsSelected = featureSet == FeatureSet.Mvc6Api
            };
            this.Items.Add(this.dataContractSerializer);

            this.xmlSerializer = new FeatureItem(
                "XmlSerializer",
                "XmlSerializer",
                "Add the XmlSerializer based input and output formatters.",
                3);
            this.Items.Add(this.xmlSerializer);

            this.both = new FeatureItem(
                "Both",
                "Both",
                "Add the DataContractSerializer and XmlSerializer based input and output formatters.",
                4);
            this.Items.Add(this.both);
        }
        private void RunButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_graphicsLayer.Graphics.Count > 0)
                {
                    Geoprocessor gpAircraftRouteGen = new Geoprocessor(_serviceURL);
                    gpAircraftRouteGen.JobCompleted += gpAircraftRouteGen_JobCompleted;
                    gpAircraftRouteGen.Failed += gpAircraftRouteGen_Failed;
                    List<GPParameter> parameters = new List<GPParameter>();
                    FeatureSet pFeatures = new FeatureSet(_graphicsLayer.Graphics);
                    parameters.Add(new GPFeatureRecordSetLayer("Route_Definition", pFeatures));
                    parameters.Add(new GPString("Aircraft_Model", aircraftmodel.Text));
                    parameters.Add(new GPDouble("Time_Step__s_", System.Convert.ToDouble(timestep.Text)));
                    string[] theTimevals = startTime.Text.Split(' ');
                    string[] theTime = theTimevals[0].Split(':');
                    int hour = 0;
                    int minute = 0;
                    int seconds = 0;
                    if (theTimevals[1] == "PM")
                        hour = System.Convert.ToInt16(theTime[0]) + 12;
                    else
                        hour = System.Convert.ToInt16(theTime[0]);
                    minute = System.Convert.ToInt16(theTime[1]);
                    seconds = System.Convert.ToInt16(theTime[2]);
                    DateTime start;
                    if (StartDate.SelectedDate == null)
                        start = new DateTime(StartDate.DisplayDate.Date.Year, StartDate.DisplayDate.Date.Month, StartDate.DisplayDate.Date.Day, hour, minute, seconds);
                    else
                        start = new DateTime(StartDate.SelectedDate.Value.Date.Year, StartDate.SelectedDate.Value.Date.Month, StartDate.SelectedDate.Value.Date.Day, hour, minute, seconds);

                    string[] theTimevalsStop = stopTime.Text.Split(' ');
                    string[] theTimeStop = theTimevalsStop[0].Split(':');
                    if (theTimevalsStop[1] == "PM")
                        hour = System.Convert.ToInt16(theTimeStop[0]) + 12;
                    else
                        hour = System.Convert.ToInt16(theTimeStop[0]);
                    minute = System.Convert.ToInt16(theTimeStop[1]);
                    seconds = System.Convert.ToInt16(theTimeStop[2]);

                    DateTime stop;
                    if (StopDate.SelectedDate == null)
                        stop = new DateTime(StopDate.DisplayDate.Date.Year, StopDate.DisplayDate.Date.Month, StopDate.DisplayDate.Date.Day, hour, minute, seconds);
                    else
                        stop = new DateTime(StopDate.SelectedDate.Value.Date.Year, StopDate.SelectedDate.Value.Date.Month, StopDate.SelectedDate.Value.Date.Day, hour, minute, seconds);

                    parameters.Add(new GPDate("Start_Time__UTC_", start.ToUniversalTime()));
                    parameters.Add(new GPDate("Stop_Time__UTC_", stop.ToUniversalTime()));

                    //gpAircraftRouteGen.OutputSpatialReference = new SpatialReference(102100);
                    gpAircraftRouteGen.OutputSpatialReference = new SpatialReference(4326);
                    gpAircraftRouteGen.SubmitJobAsync(parameters);

                    if (_mapWidget != null)
                    {
                        _mapWidget.Map.MouseClick -= Map_MouseClick;
                    }
                }
            }
            catch
            {
                System.Diagnostics.Debug.WriteLine("error");
            }
        }
 private static void RegisterFeatures(ContainerBuilder builder, FeatureSet featureSet)
 {
     switch (featureSet)
     {
         case FeatureSet.Mvc6:
             // Hidden
             builder.RegisterType<ServicesFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<SetRandomPortsFeature>().AsSelf().As<IFeature>().SingleInstance();
             // CSS and JavaScript
             builder.RegisterType<FrontEndFrameworkFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<TypeScriptFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<JavaScriptCodeStyleFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<JavaScriptTestFrameworkFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Formatters
             builder.RegisterType<JsonSerializerSettingsFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<BsonFormatterFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<XmlFormatterFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Performance
             builder.RegisterType<CstmlMinificationFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Security
             builder.RegisterType<HttpsEverywhereFeature>().AsSelf().As<IFeature>().SingleInstance();
             // SEO
             builder.RegisterType<RobotsTextFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<SitemapFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<RedirectToCanonicalUrlFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Pages
             builder.RegisterType<AboutPageFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<ContactPageFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Social
             builder.RegisterType<AuthorMetaTagFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<OpenGraphFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<TwitterCardFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Favicons
             builder.RegisterType<AppleIOSFaviconsFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<AppleMacSafariFaviconFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<AndroidChromeM36ToM38FaviconFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<AndroidChromeM39FaviconsFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<GoogleTvFaviconFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<Windows8IE10FaviconFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<Windows81IE11EdgeFaviconFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<WebAppCapableFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Other
             builder.RegisterType<FeedFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<SearchFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<HumansTextFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<ReferrerMetaTagFeature>().AsSelf().As<IFeature>().SingleInstance();
             break;
         case FeatureSet.Mvc6Api:
             // Hidden
             builder.RegisterType<SetRandomPortsFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Rest
             builder.RegisterType<SwaggerFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Formatters
             builder.RegisterType<JsonSerializerSettingsFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<BsonFormatterFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<XmlFormatterFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<NoContentFormatterFeature>().AsSelf().As<IFeature>().SingleInstance();
             builder.RegisterType<NotAcceptableFormatterFeature>().AsSelf().As<IFeature>().SingleInstance();
             // Security
             builder.RegisterType<HttpsEverywhereFeature>().AsSelf().As<IFeature>().SingleInstance();
             break;
     }
 }
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     FeatureSet fs = new FeatureSet();
 }
Example #26
0
 public CreateIsoLine(Map map1)
 {
     this.map         = map1;
     LineF            = new FeatureSet(FeatureType.Line);
     LineF.Projection = map.Projection;
 }
Example #27
0
        public static TLSimilarityMatrix Extract(ref TLSimilarityMatrix sims, string tracedir, FeatureSet set, Dictionary <int, string> qmap)
        {
            TLSimilarityMatrix newsims = new TLSimilarityMatrix();

            if (set == FeatureSet.All)
            {
                ExtractFeature(ref sims, ref newsims, tracedir + @"\" + GetFeatureSetDir(FeatureSet.Bugs) + "\\");
                ExtractFeature(ref sims, ref newsims, tracedir + @"\" + GetFeatureSetDir(FeatureSet.Features) + "\\");
                ExtractFeature(ref sims, ref newsims, tracedir + @"\" + GetFeatureSetDir(FeatureSet.Patch) + "\\");
            }
            else
            {
                RemoveNonFeature(ref sims, set, qmap);
                ExtractFeature(ref sims, ref newsims, tracedir + GetFeatureSetDir(set) + "\\");
            }

            return(newsims);
        }
Example #28
0
 public ItemContents()
 {
     features  = new FeatureSet();
     relations = new FeatureSet();
 }
Example #29
0
        private void BUT_shptopoly_Click(object sender, EventArgs e)
        {
            using (var fd = new OpenFileDialog())
            {
                fd.Filter = "Shape file|*.shp";
                var result = fd.ShowDialog();
                var file   = fd.FileName;

                var pStart    = new ProjectionInfo();
                var pESRIEnd  = KnownCoordinateSystems.Geographic.World.WGS1984;
                var reproject = false;

                if (File.Exists(file))
                {
                    var prjfile = Path.GetDirectoryName(file) + Path.DirectorySeparatorChar +
                                  Path.GetFileNameWithoutExtension(file) + ".prj";
                    if (File.Exists(prjfile))
                    {
                        using (
                            var re =
                                File.OpenText(Path.GetDirectoryName(file) + Path.DirectorySeparatorChar +
                                              Path.GetFileNameWithoutExtension(file) + ".prj"))
                        {
                            pStart.ParseEsriString(re.ReadLine());

                            reproject = true;
                        }
                    }

                    var fs = FeatureSet.Open(file);

                    fs.FillAttributes();

                    var rows = fs.NumRows();

                    var dtOriginal = fs.DataTable;
                    for (var row = 0; row < dtOriginal.Rows.Count; row++)
                    {
                        var original = dtOriginal.Rows[row].ItemArray;
                    }

                    foreach (DataColumn col in dtOriginal.Columns)
                    {
                        Console.WriteLine(col.ColumnName + " " + col.DataType);
                    }

                    var a = 1;

                    var path = Path.GetDirectoryName(file);

                    foreach (var feature in fs.Features)
                    {
                        var sb = new StringBuilder();

                        sb.Append("#Shap to Poly - Mission Planner\r\n");
                        foreach (var point in feature.Coordinates)
                        {
                            if (reproject)
                            {
                                double[] xyarray = { point.X, point.Y };
                                double[] zarray  = { point.Z };

                                Reproject.ReprojectPoints(xyarray, zarray, pStart, pESRIEnd, 0, 1);

                                point.X = xyarray[0];
                                point.Y = xyarray[1];
                                point.Z = zarray[0];
                            }

                            sb.Append(point.Y.ToString(CultureInfo.InvariantCulture) + "\t" +
                                      point.X.ToString(CultureInfo.InvariantCulture) + "\r\n");
                        }

                        log.Info("writting poly to " + path + Path.DirectorySeparatorChar + "poly-" + a + ".poly");
                        File.WriteAllText(path + Path.DirectorySeparatorChar + "poly-" + a + ".poly", sb.ToString());

                        a++;
                    }
                }
            }
        }
 public string Insert(FeatureSet entity)
 {
     return(this.repository.Insert(entity));
 }
Example #31
0
 /// <summary>
 /// Does the inference.
 /// </summary>
 /// <param name="featureSet">The feature set.</param>
 /// <param name="userNames">The user names.</param>
 /// <param name="results">The results.</param>
 public abstract void DoInference(FeatureSet featureSet, IEnumerable <string> userNames, ref Results results);
Example #32
0
        public override string CreateFeature(ProjectionInfo proj_info, string directory)
        {
            if (Locations != null)
            {
                string     filename = Path.Combine(directory, this.Name + ".shp");
                var        grid     = (Owner as Modflow).Grid as MFGrid;
                FeatureSet fs       = new FeatureSet(FeatureType.Point);
                fs.Name       = this.Name;
                fs.Projection = proj_info;
                fs.DataTable.Columns.Add(new DataColumn("CELL_ID", typeof(int)));
                fs.DataTable.Columns.Add(new DataColumn("Layer", typeof(int)));
                fs.DataTable.Columns.Add(new DataColumn("Row", typeof(int)));
                fs.DataTable.Columns.Add(new DataColumn("Column", typeof(int)));
                fs.DataTable.Columns.Add(new DataColumn("ID", typeof(int)));
                fs.DataTable.Columns.Add(new DataColumn("Elevation", typeof(double)));
                fs.DataTable.Columns.Add(new DataColumn("Name", typeof(string)));
                fs.DataTable.Columns.Add(new DataColumn(RegularGrid.ParaValueField, typeof(int)));
                int np = TimeService.StressPeriods.Count;
                for (int i = 0; i < np; i++)
                {
                    fs.DataTable.Columns.Add(new DataColumn("Flux Rate" + (i + 1), typeof(float)));
                }

                for (int i = 0; i < NWell; i++)
                {
                    int      layer   = Locations[0, i, 0];
                    int      row     = Locations[0, i, 1];
                    int      col     = Locations[0, i, 2];
                    var      coor    = grid.LocateCentroid(col, row);
                    Point    geom    = new Point(coor);
                    IFeature feature = fs.AddFeature(geom);
                    feature.DataRow.BeginEdit();
                    feature.DataRow["CELL_ID"]   = grid.Topology.GetID(row - 1, col - 1);
                    feature.DataRow["Layer"]     = layer;
                    feature.DataRow["Row"]       = row;
                    feature.DataRow["Column"]    = col;
                    feature.DataRow["ID"]        = i + 1;
                    feature.DataRow["Elevation"] = grid.GetElevationAt(row - 1, col - 1, layer - 1);
                    feature.DataRow["Name"]      = "Well" + (i + 1);
                    feature.DataRow[RegularGrid.ParaValueField] = 0;
                    for (int j = 0; j < np; j++)
                    {
                        if (FluxRates.Flags[j, 0] == TimeVarientFlag.Individual)
                        {
                            feature.DataRow["Flux Rate" + (j + 1)] = FluxRates[j, 0, i];
                        }
                        else if (FluxRates.Flags[j, 0] == TimeVarientFlag.Constant)
                        {
                            feature.DataRow["Flux Rate" + (j + 1)] = FluxRates.Constants[j, 0];
                        }
                        else if (FluxRates.Flags[j, 0] == TimeVarientFlag.Repeat)
                        {
                            feature.DataRow["Flux Rate" + (j + 1)] = FluxRates[j, 0, i];
                        }
                    }
                    feature.DataRow.EndEdit();
                }
                fs.SaveAs(filename, true);
                fs.Close();


                return(filename);
            }
            else
            {
                return(null);
            }
        }
Example #33
0
 public Audio(NotificationType context, FeatureSet supportedFeatures) : base(context, supportedFeatures)
 {
 }
 public QueryResultEventArgs(FeatureSet fset, ArcGISQueryLayer queryLayer)
 {
     this._fset       = fset;
     this._queryLayer = queryLayer;
 }
        /// <summary>
        /// Load base maps for World template project. The base shapefiles
        /// are loaded from the [Program Files]\[Cuahsi HIS]\HydroDesktop\maps\BaseData folder.
        /// </summary>
        public static Boolean LoadBaseMaps(AppManager applicationManager1, Map mainMap)
        {
            //set the projection of main map
            mainMap.Projection = projWorld.WebMercator;

            Extent defaultMapExtent = new Extent(-170, -50, 170, 50);

            string baseMapFolder = Settings.Instance.DefaultBaseMapDirectory;

            //MapGroup baseGroup = new MapGroup(mainMap.Layers, mainMap.MapFrame, mainMap.ProgressHandler);
            //baseGroup.LegendText = "Base Map Data";
            //baseGroup.ParentMapFrame = mainMap.MapFrame;
            //baseGroup.MapFrame = mainMap.MapFrame;
            //baseGroup.IsVisible = true;

            //load the 'Countries of the world' layer
            try
            {
                mainMap.BackColor = Color.LightBlue;

                string fileName = Path.Combine(baseMapFolder, "world_countries.shp");
                if (File.Exists(fileName))
                {
                    IFeatureSet     fsCountries  = FeatureSet.OpenFile(fileName);
                    MapPolygonLayer layCountries = new MapPolygonLayer(fsCountries);
                    layCountries.LegendText = "Countries";
                    layCountries.Symbolizer = new PolygonSymbolizer(Color.FromArgb(255, 239, 213), Color.LightGray);
                    //PolygonScheme schmCountries = new PolygonScheme();
                    //schmCountries.EditorSettings.StartColor = Color.Orange;
                    //schmCountries.EditorSettings.EndColor = Color.Silver;
                    //schmCountries.EditorSettings.ClassificationType =
                    //    ClassificationType.UniqueValues;
                    //schmCountries.EditorSettings.FieldName = "NAME";
                    //schmCountries.EditorSettings.UseGradient = true;
                    //schmCountries.CreateCategories(layCountries.DataSet.DataTable);
                    //layCountries.Symbology = schmCountries;
                    //baseGroup.Layers.Add(layCountries);
                    mainMap.Layers.Add(layCountries);
                    layCountries.MapFrame = mainMap.MapFrame;
                    layCountries.ProgressReportingEnabled = false;
                }
            }
            catch { }


            //load a rivers layer
            try
            {
                var fileName = Path.Combine(baseMapFolder, "world_rivers.shp");
                if (File.Exists(fileName))
                {
                    IFeatureSet fsRivers = FeatureSet.OpenFile(fileName);
                    //fsRivers.Reproject(mainMap.Projection);
                    MapLineLayer layRivers = new MapLineLayer(fsRivers);
                    layRivers.LegendText = "rivers";
                    LineSymbolizer symRivers = new LineSymbolizer(Color.Blue, 1.0);
                    layRivers.Symbolizer = symRivers;
                    mainMap.Layers.Add(layRivers);
                    layRivers.MapFrame = mainMap.MapFrame;
                }
            }
            catch { }

            //load a lakes layer
            try
            {
                var fileName = Path.Combine(baseMapFolder, "world_lakes.shp");
                if (File.Exists(fileName))
                {
                    IFeatureSet fsLakes = FeatureSet.OpenFile(fileName);
                    //fsLakes.Reproject(mainMap.Projection);
                    MapPolygonLayer layLakes = new MapPolygonLayer(fsLakes);
                    layLakes.LegendText = "lakes";
                    PolygonSymbolizer symLakes = new PolygonSymbolizer(Color.Blue,
                                                                       Color.Blue);
                    layLakes.Symbolizer = symLakes;
                    mainMap.Layers.Add(layLakes);
                    layLakes.MapFrame = mainMap.MapFrame;
                    layLakes.ProgressReportingEnabled = false;
                }
            }
            catch { }



            double[] xy = new double[4];
            xy[0] = defaultMapExtent.MinX;
            xy[1] = defaultMapExtent.MinY;
            xy[2] = defaultMapExtent.MaxX;
            xy[3] = defaultMapExtent.MaxY;
            double[] z     = new double[] { 0, 0 };
            var      wgs84 = ProjectionInfo.FromEsriString(Properties.Resources.wgs_84_esri_string);

            Reproject.ReprojectPoints(xy, z, wgs84, mainMap.Projection, 0, 2);

            mainMap.ViewExtents = new Extent(xy);

            return(true);
        }
Example #36
0
        static void Main(string[] args)
        {
            try
            {
                // Connect to the reader.
                // Change the ReaderHostname constant in SolutionConstants.cs
                // to the IP address or hostname of your reader.
                reader.Connect(SolutionConstants.ReaderHostname);

                // Query the reader features and print the results.
                Console.WriteLine("Reader Features");
                Console.WriteLine("---------------");
                FeatureSet features = reader.QueryFeatureSet();
                Console.WriteLine("Model name : {0}", features.ModelName);
                Console.WriteLine("Model number : {0}", features.ModelNumber);
                Console.WriteLine("Reader model : {0}", features.ReaderModel.ToString());
                Console.WriteLine("Firmware version : {0}", features.FirmwareVersion);
                Console.WriteLine("Antenna count : {0}\n", features.AntennaCount);

                // Write the reader features to file.
                features.Save("features.xml");

                // Query the current reader status.
                Console.WriteLine("Reader Status");
                Console.WriteLine("---------------");
                Status status = reader.QueryStatus();
                Console.WriteLine("Is connected : {0}", status.IsConnected);
                Console.WriteLine("Is singulating : {0}", status.IsSingulating);
                Console.WriteLine("Temperature : {0}° C\n", status.TemperatureInCelsius);

                // Configure the reader with the default settings.
                reader.ApplyDefaultSettings();

                // Display the current reader settings.
                DisplayCurrentSettings();

                // Save the settings to file in XML format.
                Console.WriteLine("Saving settings to file.");
                Settings settings = reader.QuerySettings();
                settings.Save("settings.xml");

                // Wait here, so we can edit the
                // settings.xml file in a text editor.
                Console.WriteLine("Edit settings.xml and press enter.");
                Console.ReadLine();

                // Load the modified settings from file.
                Console.WriteLine("Loading settings from file.");
                settings = Settings.Load("settings.xml");

                // Apply the settings we just loaded from file.
                Console.WriteLine("Applying settings from file.\n");
                reader.ApplySettings(settings);

                // Display the settings again to show the changes.
                DisplayCurrentSettings();

                // Wait for the user to press enter.
                Console.WriteLine("Press enter to exit.");
                Console.ReadLine();

                // Disconnect from the reader.
                reader.Disconnect();
            }
            catch (OctaneSdkException e)
            {
                // Handle Octane SDK errors.
                Console.WriteLine("Octane SDK exception: {0}", e.Message);
            }
            catch (Exception e)
            {
                // Handle other .NET errors.
                Console.WriteLine("Exception : {0}", e.Message);
            }
        }
Example #37
0
        public override string CreateFeature(ProjectionInfo proj_info, string directory)
        {
            if (Observations != null)
            {
                string     filename = Path.Combine(directory, this.Name + ".shp");
                var        grid     = (Owner as Modflow).Grid as MFGrid;
                FeatureSet fs       = new FeatureSet(FeatureType.Point);
                fs.Name       = this.Name;
                fs.Projection = proj_info;
                fs.DataTable.Columns.Add(new DataColumn("SiteID", typeof(int)));
                fs.DataTable.Columns.Add(new DataColumn("SiteName", typeof(string)));
                fs.DataTable.Columns.Add(new DataColumn("CELL_ID", typeof(int)));
                fs.DataTable.Columns.Add(new DataColumn("Row", typeof(int)));
                fs.DataTable.Columns.Add(new DataColumn("Column", typeof(int)));
                fs.DataTable.Columns.Add(new DataColumn("ID", typeof(int)));

                fs.DataTable.Columns.Add(new DataColumn("Elevation", typeof(float)));
                fs.DataTable.Columns.Add(new DataColumn("HSIM", typeof(float)));
                fs.DataTable.Columns.Add(new DataColumn("HOBS", typeof(float)));
                fs.DataTable.Columns.Add(new DataColumn("DepOBS", typeof(float)));
                fs.DataTable.Columns.Add(new DataColumn("DepSIM", typeof(float)));
                fs.DataTable.Columns.Add(new DataColumn("DepDIF", typeof(float)));
                fs.DataTable.Columns.Add(new DataColumn("HDIF", typeof(float)));

                fs.DataTable.Columns.Add(new DataColumn("Name", typeof(string)));
                fs.DataTable.Columns.Add(new DataColumn(RegularGrid.ParaValueField, typeof(int)));

                fs.DataTable.Columns.Add(new DataColumn("IsTR", typeof(int)));
                int i = 1;
                foreach (var vv in Observations)
                {
                    var      hob     = vv as HeadObservation;
                    var      coor    = grid.LocateCentroid(hob.Column, hob.Row);
                    Point    geom    = new Point(coor);
                    IFeature feature = fs.AddFeature(geom);
                    feature.DataRow.BeginEdit();
                    feature.DataRow["CELL_ID"] = grid.Topology.GetID(hob.Row, hob.Column);
                    feature.DataRow["Row"]     = hob.Row;
                    feature.DataRow["Column"]  = hob.Column;
                    feature.DataRow["ID"]      = hob.ID;

                    feature.DataRow["Elevation"] = hob.Elevation;
                    feature.DataRow["HSIM"]      = 0;
                    feature.DataRow["HOBS"]      = 0;

                    feature.DataRow["Name"] = hob.Name;
                    feature.DataRow[RegularGrid.ParaValueField] = 0;

                    feature.DataRow["IsTR"]     = 1;
                    feature.DataRow["SiteID"]   = i;
                    feature.DataRow["SiteName"] = hob.Name;
                    i++;
                    feature.DataRow.EndEdit();
                }
                fs.SaveAs(filename, true);
                fs.Close();
                return(filename);
            }
            else
            {
                return(null);
            }
        }
Example #38
0
        /// <summary>
        /// This tests each feature of the input
        /// </summary>
        /// <param name="self">This featureSet</param>
        /// <param name="other">The featureSet to perform intersection with</param>
        /// <param name="joinType">The attribute join type</param>
        /// <param name="progHandler">A progress handler for status messages</param>
        /// <returns>An IFeatureSet with the intersecting features, broken down based on the join Type</returns>
        public static IFeatureSet Intersection(this IFeatureSet self, IFeatureSet other, FieldJoinType joinType, IProgressHandler progHandler)
        {
            IFeatureSet   result = null;
            ProgressMeter pm     = new ProgressMeter(progHandler, "Calculating Intersection", self.Features.Count);

            if (joinType == FieldJoinType.All)
            {
                result = CombinedFields(self, other);
                // Intersection is symmetric, so only consider I X J where J <= I
                if (!self.AttributesPopulated)
                {
                    self.FillAttributes();
                }
                if (!other.AttributesPopulated)
                {
                    other.FillAttributes();
                }

                for (int i = 0; i < self.Features.Count; i++)
                {
                    IFeature        selfFeature     = self.Features[i];
                    List <IFeature> potentialOthers = other.Select(selfFeature.Envelope.ToExtent());
                    foreach (IFeature otherFeature in potentialOthers)
                    {
                        selfFeature.Intersection(otherFeature, result, joinType);
                    }
                    pm.CurrentValue = i;
                }
                pm.Reset();
            }
            else if (joinType == FieldJoinType.LocalOnly)
            {
                if (!self.AttributesPopulated)
                {
                    self.FillAttributes();
                }

                result = new FeatureSet();
                result.CopyTableSchema(self);
                result.FeatureType = self.FeatureType;
                if (other.Features != null && other.Features.Count > 0)
                {
                    pm = new ProgressMeter(progHandler, "Calculating Union", other.Features.Count);
                    IFeature union = other.Features[0];
                    for (int i = 1; i < other.Features.Count; i++)
                    {
                        union           = union.Union(other.Features[i]);
                        pm.CurrentValue = i;
                    }
                    pm.Reset();
                    pm = new ProgressMeter(progHandler, "Calculating Intersections", self.NumRows());
                    Extent otherEnvelope = new Extent(union.Envelope);
                    for (int shp = 0; shp < self.ShapeIndices.Count; shp++)
                    {
                        if (!self.ShapeIndices[shp].Extent.Intersects(otherEnvelope))
                        {
                            continue;
                        }
                        IFeature selfFeature = self.GetFeature(shp);
                        selfFeature.Intersection(union, result, joinType);
                        pm.CurrentValue = shp;
                    }
                    pm.Reset();
                }
            }
            else if (joinType == FieldJoinType.ForeignOnly)
            {
                if (!other.AttributesPopulated)
                {
                    other.FillAttributes();
                }

                result = new FeatureSet();
                result.CopyTableSchema(other);
                result.FeatureType = other.FeatureType;
                if (self.Features != null && self.Features.Count > 0)
                {
                    pm = new ProgressMeter(progHandler, "Calculating Union", self.Features.Count);
                    IFeature union = self.Features[0];
                    for (int i = 1; i < self.Features.Count; i++)
                    {
                        union           = union.Union(self.Features[i]);
                        pm.CurrentValue = i;
                    }
                    pm.Reset();
                    if (other.Features != null)
                    {
                        pm = new ProgressMeter(progHandler, "Calculating Intersection", other.Features.Count);
                        for (int i = 0; i < other.Features.Count; i++)
                        {
                            other.Features[i].Intersection(union, result, FieldJoinType.LocalOnly);
                            pm.CurrentValue = i;
                        }
                    }
                    pm.Reset();
                }
            }
            return(result);
        }
        /// <summary>
        /// Opens the specified file
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public IFeatureSet Open(string fileName)
        {
            WkbReader wkbReader = new WkbReader();

            OgrDataReader reader = new OgrDataReader(fileName);
            IFeatureSet fs = new FeatureSet();
            fs.Name = Path.GetFileNameWithoutExtension(fileName);
            fs.Filename = fileName;
            // skip the geometry column which is always column 0
            for (int i = 1; i < reader.FieldCount; i++)
            {
                string sFieldName = reader.GetName(i);
                Type type = reader.GetFieldType(i);

                int uniqueNumber = 1;
                string uniqueName = sFieldName;
                while (fs.DataTable.Columns.Contains(uniqueName))
                {
                    uniqueName = sFieldName + uniqueNumber;
                    uniqueNumber++;
                }
                fs.DataTable.Columns.Add(new DataColumn(uniqueName, type));
            }
            while (reader.Read())
            {
                byte[] wkbGeometry = (byte[])reader["Geometry"];

                IGeometry geometry = wkbReader.Read(wkbGeometry);

                IFeature feature = new Feature(geometry);
                feature.DataRow = fs.DataTable.NewRow();
                for (int i = 1; i < reader.FieldCount; i++)
                {
                    object value = reader[i];
                    if (value == null)
                    {
                        value = DBNull.Value;
                    }
                    feature.DataRow[i - 1] = value;
                }
                fs.Features.Add(feature);
            }

            try
            {
                fs.Projection = reader.GetProj4ProjectionInfo();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }

            return fs;
        }
        public void FeatureLookupIsNotNull()
        {
            var target = new FeatureSet();

            Assert.IsNotNull(target.FeatureLookup);
        }
Example #41
0
        private void Setting_Config(FeatureSet features, Settings settings)
        {
            try
            {
                // Connect to the reader.
                // Change the ReaderHostname constant in SolutionConstants.cs
                // to the IP address or hostname of your reader.
                reader.Connect(Host.Text);

                // Get the reader features to determine if the
                // reader supports a fixed-frequency table.
                features = reader.QueryFeatureSet();

                if (!features.IsHoppingRegion)
                {
                    // Get the default settings
                    // We'll use these as a starting point
                    // and then modify the settings we're
                    // interested in.
                    settings = reader.QueryDefaultSettings();


                    // Add antenna number to tag report
                    settings.Report.IncludeAntennaPortNumber = true;

                    // Send a tag report for every tag read.
                    settings.Report.Mode = report;

                    settings.ReaderMode            = read;
                    settings.SearchMode            = search;
                    settings.Session               = Convert.ToUInt16(session.Text);
                    settings.TagPopulationEstimate = 0;

                    // Specify the transmit frequencies to use.
                    // Make sure your reader supports this and
                    // that the frequencies are valid for your region.
                    // readers.(China)
                    settings.TxFrequenciesInMhz.Add(Frequencies);

                    // Start by disabling all of the antennas
                    //settings.Antennas.DisableAll();

                    //string strText = Sector.Text;
                    //string[] strArr = strText.Split(',');
                    //ushort[] usArr = new ushort[strArr.Length];
                    //for(int i = 0; i < strArr.Length; i++)
                    //{
                    //usArr[i] = Convert.ToUInt16(strArr[i]);
                    //}
                    // Enable antennas by specifying an array of antenna IDs
                    // settings.Antennas.EnableById(usArr);
                    // Or set each antenna individually
                    //settings.Antennas.GetAntenna(52).IsEnabled = true;
                    //settings.Antennas.GetAntenna(3).IsEnabled = true;
                    // ...

                    // Set all the antennas to the max transmit power and receive sensitivity
                    settings.Antennas.TxPowerMax       = true;
                    settings.Antennas.RxSensitivityMax = true;
                    // Or set all antennas to a specific value in dBm
                    settings.Antennas.TxPowerInDbm = Convert.ToDouble(Power1.Text);
                    //settings.Antennas.RxSensitivityInDbm = -70.0;
                    // Or set each antenna individually
                    //settings.Antennas.GetAntenna(1).MaxTxPower = true;
                    //settings.Antennas.GetAntenna(1).MaxRxSensitivity = true;
                    //settings.Antennas.GetAntenna(2).TxPowerInDbm = 30.0;
                    //settings.Antennas.GetAntenna(2).RxSensitivityInDbm = -70.0;
                    // ...

                    // xArray only
                    // Enable antennas by sector number
                    //settings.Antennas.EnableBySector(new ushort[] { 3, 4, 5 });

                    // xArray only
                    // Enable antennas by ring number
                    //settings.Antennas.EnableByRing(new ushort[] { 6, 7 });

                    // Tell the reader to include the
                    // RF doppler frequency in all tag reports.
                    settings.Report.IncludeDopplerFrequency = true;

                    // Tell the reader to include the
                    //First Seen Time in all tag reports.
                    settings.Report.IncludeFirstSeenTime = true;

                    // Tell the reader to include the
                    //Last Seen Time in all tag reports.
                    settings.Report.IncludeLastSeenTime = true;

                    // Tell the reader to include the
                    //Last Seen Time in all tag reports.
                    settings.Report.IncludePeakRssi = true;

                    // Tell the reader to include the
                    // RF Phase Angle in all tag reports.
                    settings.Report.IncludePhaseAngle = true;

                    settings.Report.IncludeChannel = true;

                    settings.Report.IncludeSeenCount = true;
                    // Tell the reader to include the antenna number
                    // in all tag reports. Other fields can be added
                    // to the reports in the same way by setting the
                    // appropriate Report.IncludeXXXXXXX property.
                    settings.Report.IncludeAntennaPortNumber = true;

                    // Apply the newly modified settings.
                    reader.ApplySettings(settings);

                    // Assign the TagsReported event handler.
                    // This specifies which method to call
                    // when tags reports are available.
                    // This method will in turn call a delegate
                    // to update the UI (Listbox).
                    reader.TagsReported += OnTagsReported;
                }
            }
            catch (OctaneSdkException ex)
            {
                // An Octane SDK exception occurred. Handle it here.
                System.Diagnostics.Trace.
                WriteLine("An Octane SDK exception has occurred : {0}", ex.Message);
            }
            catch (Exception ex)
            {
                // A general exception occurred. Handle it here.
                System.Diagnostics.Trace.
                WriteLine("An exception has occurred : {0}", ex.Message);
            }
        }
 public BsonFormatterFeature(IProjectService projectService, FeatureSet featureSet)
     : base(projectService)
 {
     this.featureSet = featureSet;
 }
Example #43
0
 public Selection(NotificationType context, FeatureSet supportedFeatures) : base(context, supportedFeatures)
 {
 }
        //static void Main()
        //{
        //    var thread = new System.Threading.Thread(x =>
        //    {
        //        new Startup().Execute(@"C:\Temp\New folder\1", FeatureSet.Mvc6);
        //    });
        //    thread.SetApartmentState(System.Threading.ApartmentState.STA);
        //    thread.Start();
        //}

        public void Execute(string projectFilePath, FeatureSet featureSet)
        {
            IContainer container = CreateContainer(projectFilePath, featureSet);
            IMainView mainView = container.Resolve<IMainView>();
            mainView.ShowDialog();
        }
Example #45
0
 /// <summary>
 /// Sets the observed values.
 /// </summary>
 /// <param name="instances">The instances.</param>
 /// <param name="featureSet">The feature set.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="communityPriors">The community priors.</param>
 public abstract void SetObservedValues(IList <IList <Inputs.Instance> > instances, FeatureSet featureSet, InputMode mode, CommunityPriors communityPriors);
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (this.cboLayer.Text == "")
            {
                MessageBox.Show("Please select a polyline layer");
                return;
            }
            IFeatureLayer layer  = m_Layers[this.cboLayer.SelectedIndex];
            IFeatureSet   feaset = (layer as FeatureLayer).FeatureSet;
            ProgressBox   p      = new ProgressBox(0, 100, "Suspension point check progress");

            p.ShowPregress();
            p.SetProgressValue(0);
            p.SetProgressDescription("Checking suspension point...");
            Dictionary <int, List <GeoAPI.Geometries.IPoint> > AllPoints = new Dictionary <int, List <GeoAPI.Geometries.IPoint> >();//线图层所有端点

            for (int i = 0; i < feaset.Features.Count; i++)
            {
                IFeature pFea = feaset.Features[i];
                if (pFea.Geometry.GeometryType == "LineString")
                {
                    GeoAPI.Geometries.Coordinate coord1  = pFea.Geometry.Coordinates[0];
                    GeoAPI.Geometries.IPoint     pPoint1 = new NetTopologySuite.Geometries.Point(coord1);
                    int count = pFea.Geometry.Coordinates.Count() - 1;
                    GeoAPI.Geometries.Coordinate coord2  = pFea.Geometry.Coordinates[count];
                    GeoAPI.Geometries.IPoint     pPoint2 = new NetTopologySuite.Geometries.Point(coord2);
                    AllPoints.Add(pFea.Fid, new List <GeoAPI.Geometries.IPoint>()
                    {
                        pPoint1, pPoint2
                    });
                }
                else//多线
                {
                    for (int j = 0; j < pFea.Geometry.NumGeometries; j++)
                    {
                        var geometry = pFea.Geometry.GetGeometryN(j);
                        GeoAPI.Geometries.Coordinate coord1  = geometry.Coordinates[0];
                        GeoAPI.Geometries.IPoint     pPoint1 = new NetTopologySuite.Geometries.Point(coord1);
                        int count = geometry.Coordinates.Count() - 1;
                        GeoAPI.Geometries.Coordinate coord2  = geometry.Coordinates[count];
                        GeoAPI.Geometries.IPoint     pPoint2 = new NetTopologySuite.Geometries.Point(coord2);
                        if (AllPoints.ContainsKey(pFea.Fid))
                        {
                            if (!AllPoints[pFea.Fid].Contains(pPoint1))
                            {
                                AllPoints[pFea.Fid].Add(pPoint1);
                            }
                            if (!AllPoints[pFea.Fid].Contains(pPoint2))
                            {
                                AllPoints[pFea.Fid].Add(pPoint2);
                            }
                        }
                        else
                        {
                            AllPoints.Add(pFea.Fid, new List <GeoAPI.Geometries.IPoint>()
                            {
                                pPoint1, pPoint2
                            });
                        }
                    }
                }
            }
            List <GeoAPI.Geometries.IPoint> resultPoint = new List <GeoAPI.Geometries.IPoint>();
            double pi     = Math.Round((double)(1.0 * 100 / feaset.Features.Count), 2);
            int    number = 1;

            foreach (var value in AllPoints)
            {
                p.SetProgressValue(number * pi);
                p.SetProgressDescription2(string.Format("{0} feature(s) is(are) checked, the remaining {1} feature(s) is(are) being queried", number, feaset.Features.Count - number));
                number++;
                foreach (var point in value.Value)
                {
                    bool IsSuspension = true;
                    foreach (var fea in feaset.Features)
                    {
                        if (fea.Fid == value.Key)
                        {
                            continue;
                        }
                        //一旦相交,必不是悬点
                        if (fea.Geometry.Intersects(point))
                        {
                            IsSuspension = false;
                            break;
                        }
                    }
                    if (IsSuspension && !resultPoint.Contains(point))
                    {
                        resultPoint.Add(point);
                    }
                }
            }
            AllPoints.Clear();
            p.CloseProgress();
            if (resultPoint.Count == 0)
            {
                MessageBox.Show(string.Format("{0} has no suspension point.", layer.LegendText));
            }
            else
            {
                IFeatureSet pSet   = new FeatureSet(FeatureType.Point);
                string[]    Fields = new string[3] {
                    "ID", "X", "Y"
                };
                foreach (string field in Fields)
                {
                    pSet.DataTable.Columns.Add(field);
                }
                int s = 0;
                foreach (var point in resultPoint)
                {
                    IFeature pFea = pSet.AddFeature(point);
                    pFea.DataRow[0] = s;
                    pFea.DataRow[1] = point.X;
                    pFea.DataRow[2] = point.Y;
                    s++;
                }
                pSet.Projection = MainWindow.m_DotMap.Projection;
                pSet.Name       = m_Layers[this.cboLayer.SelectedIndex].LegendText + "_suspenion points";
                var             feaLayer = MainWindow.m_DotMap.Layers.Add(pSet);
                PointSymbolizer symbol   = new PointSymbolizer(System.Drawing.Color.Red, DotSpatial.Symbology.PointShape.Ellipse, 5);
                feaLayer.Symbolizer = symbol;
                MessageBox.Show(string.Format("{0} has {1} suspension point.", layer.LegendText, resultPoint.Count.ToString()));
            }
            this.Close();
        }
 public AdaptiveContainer(NotificationType context, FeatureSet supportedFeatures) : base(context, supportedFeatures)
 {
 }
 public NewsFeedItem(FeatureSet supportedFeatures)
 {
     SupportedFeatures = supportedFeatures;
 }
Example #49
0
        private void populateLayerPanel(List <GraphicsLayer> inputLayers)
        {
            layerPanel.Children.Clear();
            if (inputLayers.Count > 0)
            {
                cb = new ComboBox()
                {
                    HorizontalAlignment = System.Windows.HorizontalAlignment.Left,
                    Width      = 125,
                    Height     = 24,
                    Foreground = new SolidColorBrush(Colors.Black)
                };
                populateLayerList(inputLayers);
                cb.SetValue(Grid.ColumnProperty, 1);
                cb.SelectionChanged += (a, b) =>
                {
                    GraphicsLayer selLayer = cb.SelectedItem as GraphicsLayer;
                    if (selLayer != null)
                    {
                        InputLayerID = selLayer.ID;
                        FeatureSet features         = new FeatureSet();
                        FeatureSet selectedFeatures = new FeatureSet();

                        foreach (Graphic g in selLayer.Graphics)
                        {
                            if (g.Geometry != null)
                            {
                                if (features.SpatialReference == null)
                                {
                                    features.SpatialReference = g.Geometry.SpatialReference;
                                }
                                Graphic newG = new Graphic();
                                newG.Geometry = g.Geometry;
                                features.Features.Add(newG);
                                if (g.Selected)
                                {
                                    selectedFeatures.Features.Add(newG);
                                }
                            }
                        }
                        if (selectedFeatures.Features.Count > 0)
                        {
                            Value = new GPFeatureRecordSetLayer(Config.Name, selectedFeatures);
                        }
                        else
                        {
                            Value = new GPFeatureRecordSetLayer(Config.Name, features);
                        }
                    }
                    else
                    {
                        Value = null;
                    }
                    RaiseCanExecuteChanged();
                };
                layerPanel.Children.Add(cb);
                RaiseCanExecuteChanged();
            }
            else
            {
                TextBlock tb = new TextBlock()
                {
                    Text = string.Format(Resources.Strings.NoLayersAvailable, getGeometryType())
                };
                ToolTipService.SetToolTip(tb, string.Format(Resources.Strings.AddLayersToMap, getGeometryType()));
                layerPanel.Children.Add(tb);
                RaiseCanExecuteChanged();
            }
        }
Example #50
0
 /// <summary>
 /// Checks whether device supports the given feature
 /// </summary>
 /// <param name="featureSet"></param>
 /// <returns></returns>
 public bool Supports(FeatureSet featureSet)
 {
     return(NativeMethods.cuda_DeviceInfo_supports(ptr, (int)featureSet) != 0);
 }
        public void SaveFeatureToShapefileWithMandZ(CoordinateType c, FeatureType ft)
        {
            var fileName = FileTools.GetTempFileName(".shp");

            try
            {
                List <Coordinate> coords = new List <Coordinate>
                {
                    new Coordinate(1, 2, 7, 4),
                    new Coordinate(3, 4, 5, 6),
                    new Coordinate(5, 6, 3, 8),
                    new Coordinate(7, 8, 9, 10),
                    new Coordinate(1, 2, 7, 4)
                };

                var fs = new FeatureSet(ft)
                {
                    Projection     = KnownCoordinateSystems.Geographic.World.WGS1984,
                    CoordinateType = c
                };

                switch (ft)
                {
                case FeatureType.Line:
                    fs.AddFeature(new LineString(coords.ToArray()));
                    break;

                case FeatureType.Polygon:
                    fs.AddFeature(new Polygon(new LinearRing(coords.ToArray())));
                    break;

                case FeatureType.MultiPoint:
                    coords.RemoveAt(4);
                    fs.AddFeature(new MultiPoint(coords.CastToPointArray()));
                    break;
                }

                Assert.DoesNotThrow(() => fs.SaveAs(fileName, true));

                var loaded = FeatureSet.Open(fileName);

                if (c == CoordinateType.Regular)
                {
                    // regular coordinates don't have m values
                    Assert.AreEqual(double.NaN, loaded.Features[0].Geometry.Coordinates[0].M);
                    Assert.AreEqual(double.NaN, loaded.Features[0].Geometry.EnvelopeInternal.Minimum.M);
                    Assert.AreEqual(double.NaN, loaded.Features[0].Geometry.EnvelopeInternal.Maximum.M);
                }
                else
                {
                    // m or z coordinates have m values
                    Assert.AreEqual(4, loaded.Features[0].Geometry.Coordinates[0].M);
                    Assert.AreEqual(4, loaded.Features[0].Geometry.EnvelopeInternal.Minimum.M);
                    Assert.AreEqual(10, loaded.Features[0].Geometry.EnvelopeInternal.Maximum.M);
                }

                if (c == CoordinateType.Z)
                {
                    // z coordinates have z values
                    Assert.AreEqual(7, loaded.Features[0].Geometry.Coordinates[0].Z);
                    Assert.AreEqual(3, loaded.Features[0].Geometry.EnvelopeInternal.Minimum.Z);
                    Assert.AreEqual(9, loaded.Features[0].Geometry.EnvelopeInternal.Maximum.Z);
                }
                else
                {
                    // regular and m coordinates don't have z values
                    Assert.AreEqual(double.NaN, loaded.Features[0].Geometry.Coordinates[0].Z);
                    Assert.AreEqual(double.NaN, loaded.Features[0].Geometry.EnvelopeInternal.Minimum.Z);
                    Assert.AreEqual(double.NaN, loaded.Features[0].Geometry.EnvelopeInternal.Maximum.Z);
                }
            }
            finally
            {
                FileTools.DeleteShapeFile(fileName);
            }
        }
 public AdaptiveChildElement(NotificationType context, FeatureSet supportedFeatures) : base(context, supportedFeatures)
 {
 }
 private void featureLayer_UpdateCompleted(object sender, EventArgs e)
 {
     FeatureSet featureSet = new FeatureSet((sender as FeatureLayer).Graphics);
     string jsonOutput = featureSet.ToJson();
     OutTextBox.Text = jsonOutput;
 }
Example #54
0
        /// <summary>
        /// Draws the labels for the given features.
        /// </summary>
        /// <param name="e">MapArgs to get Graphics object from.</param>
        /// <param name="features">Indizes of the features whose labels get drawn.</param>
        private void DrawFeatures(MapArgs e, IEnumerable <int> features)
        {
            // Check that exists at least one category with Expression
            if (Symbology.Categories.All(_ => string.IsNullOrEmpty(_.Expression)))
            {
                return;
            }

            Graphics g             = e.Device ?? Graphics.FromImage(BackBuffer);
            Matrix   origTransform = g.Transform;

            // Only draw features that are currently visible.
            if (FastDrawnStates == null)
            {
                CreateIndexedLabels();
            }

            FastLabelDrawnState[] drawStates = FastDrawnStates;
            if (drawStates == null)
            {
                return;
            }

            // Sets the graphics objects smoothing modes
            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            g.SmoothingMode     = SmoothingMode.AntiAlias;

            Action <int, IFeature> drawFeature;

            switch (FeatureSet.FeatureType)
            {
            case FeatureType.Polygon:
                drawFeature = (fid, feature) => DrawPolygonFeature(e, g, feature, drawStates[fid].Category, drawStates[fid].Selected, ExistingLabels);
                break;

            case FeatureType.Line:
                drawFeature = (fid, feature) => DrawLineFeature(e, g, feature, drawStates[fid].Category, drawStates[fid].Selected, ExistingLabels);
                break;

            case FeatureType.Point:
            case FeatureType.MultiPoint:
                drawFeature = (fid, feature) => DrawPointFeature(e, g, feature, drawStates[fid].Category, drawStates[fid].Selected, ExistingLabels);
                break;

            default:
                return;     // Can't draw something else
            }

            foreach (var category in Symbology.Categories)
            {
                category.UpdateExpressionColumns(FeatureSet.DataTable.Columns);
                var catFeatures = new List <int>();
                foreach (int fid in features)
                {
                    if (drawStates[fid] == null || drawStates[fid].Category == null)
                    {
                        continue;
                    }
                    if (drawStates[fid].Category == category)
                    {
                        catFeatures.Add(fid);
                    }
                }

                // Now that we are restricted to a certain category, we can look at priority
                if (category.Symbolizer.PriorityField != "FID")
                {
                    Feature.ComparisonField = category.Symbolizer.PriorityField;
                    catFeatures.Sort();

                    // When preventing collisions, we want to do high priority first.
                    // Otherwise, do high priority last.
                    if (category.Symbolizer.PreventCollisions)
                    {
                        if (!category.Symbolizer.PrioritizeLowValues)
                        {
                            catFeatures.Reverse();
                        }
                    }
                    else
                    {
                        if (category.Symbolizer.PrioritizeLowValues)
                        {
                            catFeatures.Reverse();
                        }
                    }
                }

                foreach (var fid in catFeatures)
                {
                    if (!FeatureLayer.DrawnStates[fid].Visible)
                    {
                        continue;
                    }
                    var feature = FeatureSet.GetFeature(fid);
                    drawFeature(fid, feature);
                }
            }

            if (e.Device == null)
            {
                g.Dispose();
            }
            else
            {
                g.Transform = origTransform;
            }
        }
Example #55
0
        private static void RegisterFeatures(ContainerBuilder builder, FeatureSet featureSet)
        {
            switch (featureSet)
            {
            case FeatureSet.Mvc6:
                // Hidden
                builder.RegisterType <JavaScriptLintFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <ServicesFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <SetRandomPortsFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <AssemblyCopyrightFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <NpmPackageNameFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Target Framework
                builder.RegisterType <TargetFrameworkFeature>().AsSelf().As <IFeature>().SingleInstance();
                // CSS and JavaScript
                builder.RegisterType <FrontEndFrameworkFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <TypeScriptFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <JavaScriptCodeStyleFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <JavaScriptHintFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <JavaScriptTestFrameworkFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Formatters
                builder.RegisterType <JsonSerializerSettingsFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <XmlFormatterFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Performance
                builder.RegisterType <CstmlMinificationFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Security
                builder.RegisterType <HttpsEverywhereFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <NWebSecFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Monitoring
                builder.RegisterType <ApplicationInsightsFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Debugging
                builder.RegisterType <GlimpseFeature>().AsSelf().As <IFeature>().SingleInstance();
                // SEO
                builder.RegisterType <RobotsTextFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <SitemapFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <RedirectToCanonicalUrlFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Pages
                builder.RegisterType <AboutPageFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <ContactPageFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Social
                builder.RegisterType <AuthorMetaTagFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <OpenGraphFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <TwitterCardFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Favicons
                builder.RegisterType <AppleIOSFaviconsFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <AppleMacSafariFaviconFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <AndroidChromeM36ToM38FaviconFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <AndroidChromeM39FaviconsFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <GoogleTvFaviconFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <Windows8IE10FaviconFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <Windows81IE11EdgeFaviconFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <WebAppCapableFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Other
                builder.RegisterType <FeedFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <SearchFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <HumansTextFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <ReferrerMetaTagFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <HttpExceptionFeature>().AsSelf().As <IFeature>().SingleInstance();
                break;

            case FeatureSet.Mvc6Api:
                // Hidden
                builder.RegisterType <SetRandomPortsFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Rest
                builder.RegisterType <SwaggerFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Formatters
                builder.RegisterType <JsonSerializerSettingsFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <XmlFormatterFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <NoContentFormatterFeature>().AsSelf().As <IFeature>().SingleInstance();
                builder.RegisterType <NotAcceptableFormatterFeature>().AsSelf().As <IFeature>().SingleInstance();
                // Security
                builder.RegisterType <HttpsEverywhereFeature>().AsSelf().As <IFeature>().SingleInstance();
                break;
            }
        }
Example #56
0
        static void Main(string[] args)
        {
            try
            {
                // Connect to the reader.
                // Pass in a reader hostname or IP address as a
                // command line argument when running the example
                if (args.Length != 1)
                {
                    Console.WriteLine("Error: No hostname specified.  Pass in the reader hostname as a command line argument when running the Sdk Example.");
                    return;
                }
                string hostname = args[0];
                reader.Connect(hostname);

                string executingPath = Path.GetFullPath(Path.Combine(Assembly.GetExecutingAssembly().Location, ".."));

                // Query the reader features and print the results.
                Console.WriteLine("Reader Features");
                Console.WriteLine("---------------");
                FeatureSet features = reader.QueryFeatureSet();
                Console.WriteLine("Model name : {0}", features.ModelName);
                Console.WriteLine("Model number : {0}", features.ModelNumber);
                Console.WriteLine("Reader model : {0}", features.ReaderModel.ToString());
                Console.WriteLine("Firmware version : {0}", features.FirmwareVersion);
                Console.WriteLine("Antenna count : {0}\n", features.AntennaCount);

                // Write the reader features to file.
                string featuresFile = Path.Combine(executingPath, "features.xml");
                features.Save(featuresFile);

                // Query the current reader status.
                Console.WriteLine("Reader Status");
                Console.WriteLine("---------------");
                Status status = reader.QueryStatus();
                Console.WriteLine("Is connected : {0}", status.IsConnected);
                Console.WriteLine("Is singulating : {0}", status.IsSingulating);
                Console.WriteLine("Temperature : {0}° C\n", status.TemperatureInCelsius);

                // Configure the reader with the default settings.
                reader.ApplyDefaultSettings();

                // Display the current reader settings.
                DisplayCurrentSettings();

                // Save the settings to file in XML format.
                Console.WriteLine("Saving settings to file.");
                Settings settings     = reader.QuerySettings();
                string   settingsFile = Path.Combine(executingPath, "settings.xml");
                settings.Save(settingsFile);

                // Wait here, so we can edit the
                // settings.xml file in a text editor.
                Console.WriteLine("Edit settings.xml and press enter.");
                Console.ReadLine();

                // Load the modified settings from file.
                Console.WriteLine("Loading settings from file.");
                settings = Settings.Load(settingsFile);

                // Apply the settings we just loaded from file.
                Console.WriteLine("Applying settings from file.\n");
                reader.ApplySettings(settings);

                // Display the settings again to show the changes.
                DisplayCurrentSettings();

                // Wait for the user to press enter.
                Console.WriteLine("Press enter to exit.");
                Console.ReadLine();

                // Disconnect from the reader.
                reader.Disconnect();
            }
            catch (OctaneSdkException e)
            {
                // Handle Octane SDK errors.
                Console.WriteLine("Octane SDK exception: {0}", e.Message);
            }
            catch (Exception e)
            {
                // Handle other .NET errors.
                Console.WriteLine("Exception : {0}", e.Message);
            }
        }
        void MyMap_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "SpatialReference")
            {
                MyMap.PropertyChanged -= MyMap_PropertyChanged;

                _legendGridCollapsed = false;
                _classGridCollapsed = false;

                LegendCollapsedTriangle.MouseLeftButtonUp += Triangle_MouseLeftButtonUp;
                LegendExpandedTriangle.MouseLeftButtonUp += Triangle_MouseLeftButtonUp;
                ClassCollapsedTriangle.MouseLeftButtonUp += Triangle_MouseLeftButtonUp;
                ClassExpandedTriangle.MouseLeftButtonUp += Triangle_MouseLeftButtonUp;

                // Get start value for number of classifications in XAML.
                _lastGeneratedClassCount = Convert.ToInt32(((ComboBoxItem)ClassCountCombo.SelectedItem).Content);

                // Set query where clause to include features with an area greater than 70 square miles.  This
                // will effectively exclude the District of Columbia from attributes to avoid skewing classifications.
                ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query()
                {
                    Where = "SQMI > 70",
                    OutSpatialReference = MyMap.SpatialReference,
                    ReturnGeometry = true
                };
                query.OutFields.Add("*");

                QueryTask queryTask =
                    new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5");

                queryTask.ExecuteCompleted += (evtsender, args) =>
                {
                    if (args.FeatureSet == null)
                        return;
                    _featureSet = args.FeatureSet;
                    SetRangeValues();
                    RenderButton.IsEnabled = true;
                };

                queryTask.ExecuteAsync(query);

                CreateColorList();
                CreateThematicList();
            }
        }
Example #58
0
        public static FeatureSet Execute(Raster rst, ContourType contourType, string fieldName = "Value", double[] levels = null)
        {
            double[] lev = levels;
            _noData = rst.NoDataValue;
            _type   = contourType;
            Raster iRst = RasterCheck(rst, lev);

            string field = fieldName ?? "Value";

            double[] x = new double[rst.NumColumns];
            double[] y = new double[rst.NumRows];

            for (int i = 0; i < rst.NumColumns; i++)
            {
                x[i] = rst.Extent.MinX + rst.CellWidth * i + rst.CellWidth / 2;
            }

            for (int i = 0; i < rst.NumRows; i++)
            {
                y[i] = rst.Extent.MaxY - rst.CellHeight * i - rst.CellHeight / 2;
            }

            FeatureSet fs = null;

            switch (_type)
            {
            case ContourType.Line:
            {
                fs = new FeatureSet(FeatureType.Line);
                fs.DataTable.Columns.Add(field, typeof(double));

                if (levels != null)
                {
                    for (int z = 0; z < levels.Length; z++)
                    {
                        IList <IGeometry> cont = GetContours(ref iRst, x, y, lev[z]);

                        foreach (var g in cont)
                        {
                            var f = (Feature)fs.AddFeature((ILineString)g);
                            f.DataRow[field] = lev[z];
                        }
                    }
                }
            }
            break;

            case ContourType.Polygon:
            {
                fs = new FeatureSet(FeatureType.Polygon);

                fs.DataTable.Columns.Add("Lev", typeof(int));
                fs.DataTable.Columns.Add("Label", typeof(string));

                Collection <IGeometry> contours = new Collection <IGeometry>();
                if (levels != null)
                {
                    for (int z = 0; z < levels.Count(); z++)
                    {
                        IList <IGeometry> cont = GetContours(ref iRst, x, y, lev[z]);

                        foreach (var g in cont)
                        {
                            contours.Add(new LineString(g.Coordinates));
                        }
                    }

                    Coordinate[] boundary = new Coordinate[5];

                    boundary[0] = new Coordinate(x[0], y[0]);
                    boundary[1] = new Coordinate(x[0], y[rst.NumRows - 1]);
                    boundary[2] = new Coordinate(x[rst.NumColumns - 1], y[rst.NumRows - 1]);
                    boundary[3] = new Coordinate(x[rst.NumColumns - 1], y[0]);
                    boundary[4] = new Coordinate(x[0], y[0]);

                    contours.Add(new LineString(boundary));

                    Collection <IGeometry> nodedContours = new Collection <IGeometry>();
                    IPrecisionModel        pm            = new PrecisionModel(1000d);
                    GeometryNoder          geomNoder     = new GeometryNoder(pm);

                    foreach (var c in geomNoder.Node(contours))
                    {
                        nodedContours.Add(c);
                    }

                    Polygonizer polygonizer = new Polygonizer();
                    polygonizer.Add(nodedContours);

                    foreach (IPolygon p in polygonizer.GetPolygons())
                    {
                        IPoint pnt = p.InteriorPoint;

                        int c = (int)((pnt.X - iRst.Extent.MinX) / iRst.CellWidth);
                        int r = (int)((iRst.Extent.MaxY - pnt.Y) / iRst.CellHeight);

                        double z = iRst.Value[r, c];

                        int    cls   = GetLevel(z, lev);
                        string label = "Undefined";

                        if (cls == -1)
                        {
                            label = "< " + lev[0];
                        }
                        else if (cls == lev.Count())
                        {
                            label = "> " + lev[lev.Count() - 1];
                        }
                        else if (cls >= 0 & cls < lev.Count())
                        {
                            label = lev[cls] + " - " + lev[cls + 1];
                        }

                        IFeature f = fs.AddFeature(p);
                        f.DataRow["Lev"]   = cls;
                        f.DataRow["Label"] = label;
                    }
                }
            }
            break;
            }

            return(fs);
        }
 public string Update(FeatureSet entity)
 {
     return(this.repository.Update(entity));
 }
        private void LoadGraphics()
        {
            // Set query where clause to include features with an area greater than 70 square miles.  This
            // will effectively exclude the District of Columbia from attributes to avoid skewing classifications.
            ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query()
            {
                Where = "SQMI > 70",
                ReturnGeometry = true,
                OutSpatialReference = MyMap.SpatialReference
            };
            query.OutFields.Add("*");

            QueryTask queryTask = new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/" +
                "Demographics/ESRI_Census_USA/MapServer/5");

            queryTask.ExecuteCompleted += (evtsender, args) =>
            {
                if (args.FeatureSet == null)
                    return;
                _featureSet = args.FeatureSet;
                SetRangeValues();
                RenderButton.IsEnabled = true;
            };

            queryTask.ExecuteAsync(query);

            CreateColorList();
            CreateThematicList();
        }