Exemple #1
0
        private void UpdatePolygonalFeature(FtTransmitterDataset dataset)
        {
            ErasePolygonalFeatures(dataset);
            DrawPolygonalFeatures(dataset);

            UpdatePolygonalLegend(ActivePolygonalVectorLayers.Keys.ToList());
        }
Exemple #2
0
        private void DrawPuntualFeature(FtTransmitterDataset dataset)
        {
            var puntualLayer = new FtPuntualVectorLayer(this, dataset);

            ActiveVectorLayers.Add(dataset, puntualLayer);
            VariableLayers.AddCollection(puntualLayer);
        }
Exemple #3
0
        public FrmTagConfig(FtTransmitterDataset dataset)
        {
            _dataset = dataset;
            InitializeComponent();
            this.Text = $"Konfiguration für Tag {dataset.TagId}";

            pictureBox1.BackColor = dataset.Visulization.Color;

            InitVisualizersCombobox();
            NewSymbolizerType = dataset.Visulization.Symbolizer.GetType();
            NewColor          = dataset.Visulization.Color;
            NewLabelState     = dataset.Visulization.SymbolizerWithLabel;

            int idx = 0;

            foreach (var item in cmboVisualizer.Items)
            {
                if ((Type)((ComboBoxItem)item).Tag == NewSymbolizerType)
                {
                    break;
                }
                idx++;
            }
            cmboVisualizer.SelectedIndex = idx;
            chkLabeled.Checked           = NewLabelState;
        }
 private TreeNodeAdv CreateParentTreeNode(FtTransmitterDataset dataset)
 {
     return(new TreeNodeAdv(CreateTreeViewNodeDescriptor(dataset))
     {
         Tag = new TreeNodeTagObject(TreeNodeTagObject.TreeViewNodeType.RootNode, dataset)
     });
 }
Exemple #5
0
        private void CreateLegendRow(FtTransmitterDataset dataset, Graphics g, float x, float y, float rowHeight)
        {
            var    spacingOffs = rowHeight * 0.15;
            string str         = CreateLegendString(dataset);

            //g.DrawRectangle(new Pen(dataset.Color), x, (float) (y + spacingOffs), rowHeight, (float)(rowHeight - (float)(2 * spacingOffs)));
            g.FillRectangle(new SolidBrush(dataset.Visulization.Color), x, (float)(y + spacingOffs), rowHeight, (float)(rowHeight - (float)(2 * spacingOffs)));
            g.DrawString(String.Format(FormatString, dataset.TagId, str), Font, ForeGroundBrush, x + colorFieldOffs, y);
        }
 private TreeNodeAdv CreatePunktwolkeTreeNode(FtTransmitterDataset dataset, int imageIndex)
 {
     return(new TreeNodeAdv("Punktwolke")
     {
         Tag = new TreeNodeTagObject(TreeNodeTagObject.TreeViewNodeType.PunktewolkeNode, dataset),
         ShowCheckBox = true,
         LeftImageIndices = new[] { imageIndex }
     });
 }
Exemple #7
0
        public FrmGraph(FtTransmitterDataset dataset)
        {
            _dataset = dataset;

            InitializeComponent();

            this.Text = $"Graphdarstellung für Tag-ID {_dataset.TagId}";
            PopulateComboBox();
            SetMinMaxDate();
        }
Exemple #8
0
        private void ErasePuntualFeature(FtTransmitterDataset dataset)
        {
            var puntualVectorLayer = ActiveVectorLayers[dataset];

            ActiveVectorLayers.Remove(dataset);

            // Labellayer kann null sein, wenn für das Feature keine Labels angezeigt werden sollen
            if (puntualVectorLayer.LabelLayer != null)
            {
                VariableLayers.Remove(puntualVectorLayer.LabelLayer);
            }
            VariableLayers.Remove(puntualVectorLayer.SymbolizerLayer);
        }
        //private void MCPAvailable(object sender, MCPAvailableArgs e)
        //{
        //    CreateMCPNode(e.Dataset, e.PercentageMCP);
        //}

        private void CreateMCPNode(FtTransmitterDataset dataset, FtTransmitterMCPDataEntry mcpEntry, int percentageMCP)
        {
            var parent = GetParentTreeNodeForTag(dataset);

            var tn = new TreeNodeAdv($"MCP {percentageMCP}%")
            {
                ShowCheckBox     = true,
                LeftImageIndices = parent.LeftImageIndices,
                Tag = new TreeNodeTagObject(TreeNodeTagObject.TreeViewNodeType.MCPNode, dataset, mcpEntry)
            };

            parent.Nodes.Add(tn);
            SetTreeNodeCheckState(tn, true);
            RegenImageList();
        }
        private TreeNodeAdv GetParentTreeNodeForTag(FtTransmitterDataset dataset)
        {
            if (treeViewTagList.Nodes.Count == 0)
            {
                return(null);
            }

            foreach (TreeNodeAdv treeNode in treeViewTagList.Nodes)
            {
                if (((TreeNodeTagObject)treeNode.Tag).NodeDataset == dataset)
                {
                    return(treeNode);
                }
            }
            return(null);
        }
        public FrmTagTabelle(FtTransmitterDataset dataset)
        {
            _dataset = dataset;
            _dataset.GPSData.FilterChanged += GPSData_FilterChanged;
            InitializeComponent();

            this.Text =
                $"GPS-Daten für Tag-ID {_dataset.TagId} von ({_dataset.GPSData.DateTimeFilterStart} - {_dataset.GPSData.DateTimeFilterStop})";

            BindingSource source = new BindingSource {
                DataSource = CreateDataTable()
            };

            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource          = source;
        }
Exemple #12
0
        private void ErasePolygonalFeatures(FtTransmitterDataset dataset)
        {
            foreach (var mcpEntry in dataset.MCPData)
            {
                if (!ActivePolygonalVectorLayers.ContainsKey(mcpEntry))
                {
                    continue;
                }

                var activePolygonalVectorLayerMCP = ActivePolygonalVectorLayers[mcpEntry];

                ActivePolygonalVectorLayers.Remove(mcpEntry);
                this.VariableLayers.Remove(activePolygonalVectorLayerMCP);
            }

            //var puntualVectorLayer = ActiveVectorLayers[dataset];
        }
Exemple #13
0
        private string CreateLegendString(FtTransmitterDataset dataset)
        {
            DateTime     start, end;
            const string format = "g";

            if (dataset.GPSData.DateTimeFilterStart.HasValue && dataset.GPSData.DateTimeFilterStop.HasValue)
            {
                start = dataset.GPSData.DateTimeFilterStart.Value;
                end   = dataset.GPSData.DateTimeFilterStop.Value;
            }
            else
            {
                start = dataset.GPSData.GpsSeries.GetFirstGpsDataEntry().StartTimestamp;
                end   = dataset.GPSData.GpsSeries.GetLatestGpsDataEntry().StartTimestamp;
            }

            return(String.Format("{0} - {1}", start.ToString(format), end.ToString(format)));
        }
        public FrmAccAxisView(FtTransmitterDataset transmitterData)
        {
            InitializeComponent();
            dataset   = transmitterData;
            this.Text = $"Beschleunigungswerte für Tag {dataset.TagId} im zeitlichen Verlauf";
            cmboAggregate.SelectedIndex = 0;
            comboBox1.SelectedIndex     = 0;
            RegenChart();
            cmboAggregate.SelectedIndexChanged += cmboAggregate_SelectedIndexChanged;
            comboBox1.SelectedIndexChanged     += comboBox1_SelectedIndexChanged;
            chart1.MouseWheel += Chart1OnMouseWheel;

            DataStartTimestamp = dataset.AccelData.GetFirstBurstTimestamp();
            DataStopTimestamp  = dataset.AccelData.GetLastBurstTimestamp();
            //dateIntervalPicker1.

            DataStartTimestampOA = DataStartTimestamp.ToOADate();
            DataStopTimestampOA  = DataStopTimestamp.ToOADate();
            //chart1.CursorPositionChanged += Chart1OnCursorPositionChanged;
        }
Exemple #15
0
        private void DrawPolygonalFeatures(FtTransmitterDataset dataset)
        {
            foreach (var polygonalFeature in dataset.MCPData)
            {
                if (!polygonalFeature.Active)
                {
                    continue;
                }

                var poly = this.Factory.CreatePolygon(polygonalFeature.Polygon.Vertices.ToArray());
                var polygonalVectorLayer = new PolygonalVectorLayer(dataset.TagId.ToString() + "MCP" + polygonalFeature.PercentageMCP, new GeometryProvider(poly))
                {
                    Symbolizer = new FtPolygonWithAlphaSymbolizer(polygonalFeature.Color,
                                                                  Properties.Settings.Default.HRPolygonDrawMode == HomeRangePolygonDrawMode.NurUmring)
                };

                ActivePolygonalVectorLayers.Add(polygonalFeature, polygonalVectorLayer);
                this.VariableLayers.Add(polygonalVectorLayer);
            }
        }
Exemple #16
0
        private void UpdatePuntualFeature(FtTransmitterDataset dataset)
        {
            if (!dataset.Active)
            {
                if (ActiveVectorLayers.ContainsKey(dataset))
                {
                    ErasePuntualFeature(dataset);
                }
            }
            else // dataset.Active
            {
                if (ActiveVectorLayers.ContainsKey(dataset))
                {
                    ErasePuntualFeature(dataset);
                    DrawPuntualFeature(dataset);
                }
                else
                {
                    DrawPuntualFeature(dataset);
                }
            }

            UpdatePuntualLegend(ActiveVectorLayers.Keys.ToList());
        }
 public MCPAvailableArgs(FtTransmitterDataset dataset, int percentageMCP)
 {
     this.Dataset       = dataset;
     this.PercentageMCP = percentageMCP;
 }
        private void View_CreateKDE(object sender, EventArgs e)
        {
            FtTransmitterDataset dataset = Project.Datasets.First(ds => ds.Active);

            var xValuesAsArray = dataset.GPSData.XValueArray;
            var yValuesAsArray = dataset.GPSData.YValueArray;

            var xVariance = Accord.Statistics.Measures.Variance(xValuesAsArray);
            var yVariance = Accord.Statistics.Measures.Variance(yValuesAsArray);

            var cellsize = Math.Sqrt(Math.Min(xVariance, yVariance)) / 100;

            var env = dataset.GPSData.GetEnvelope();

            var rowCnt = (int)Math.Ceiling(env.Height / cellsize);
            var colCnt = (int)Math.Ceiling(env.Width / cellsize);

            var z = Math.Max(rowCnt, colCnt);

            Dictionary <Envelope, Tuple <int, int> > envelopes = new Dictionary <Envelope, Tuple <int, int> >();

            for (int i = 0; i < z; i++)
            {
                for (int j = 0; j < z; j++)
                {
                    Coordinate c1 = new Coordinate(env.MinX + j * cellsize, env.MaxY - i * cellsize);
                    Coordinate c2 = new Coordinate(env.MinX + (j + 1) * cellsize, env.MaxY - (i + 1) * cellsize);

                    envelopes.Add(new Envelope(c1, c2), new Tuple <int, int>(i, j));
                }
            }

            List <double[]> samples = new List <double[]>();

            foreach (var gpsPoint in dataset.GPSData)
            {
                if (!gpsPoint.IsValid())
                {
                    continue;
                }
                foreach (var kvp in envelopes)
                {
                    if (kvp.Key.Contains(new Coordinate(gpsPoint.Rechtswert.Value, gpsPoint.Hochwert.Value)))
                    {
                        samples.Add(new double[] { kvp.Value.Item2, kvp.Value.Item1 });
                        break;
                    }
                }
            }

            double[][] samplesarr = new double[samples.Count][];
            int        h          = 0;

            foreach (var blub in samples)
            {
                samplesarr[h++] = blub;
            }

            Accord.Statistics.Distributions.Multivariate.MultivariateEmpiricalDistribution kde =
                new Accord.Statistics.Distributions.Multivariate.MultivariateEmpiricalDistribution(samplesarr);

            Bitmap bmp = new Bitmap(z, z);

            List <double> densities = new List <double>();

            for (int i = 0; i < z; i++)
            {
                for (int j = 0; j < z; j++)
                {
                    densities.Add(kde.ProbabilityDensityFunction(new double[] { i, j }));
                }
            }

            var minDens = densities.Min();
            var maxDens = densities.Max();

            var diffDens = maxDens - minDens;

            for (int i = 0; i < z; i++)
            {
                for (int j = 0; j < z; j++)
                {
                    var densityAtPoint = kde.ProbabilityDensityFunction(new double[] { i, j });

                    Debug.WriteLine(diffDens / densityAtPoint);

                    var greyValue = (int)Math.Floor(255 * densityAtPoint / maxDens);

                    bmp.SetPixel(i, j, Color.FromArgb(greyValue, greyValue, greyValue));

                    //var bla = (int) Math.Floor(120*densityAtPoint/maxDens);

                    //int r, g, b;
                    //ColorUtil.HsvToRgb(bla, 1, 1, out r, out g, out b);
                    //bmp.SetPixel(i, j, Color.FromArgb(r, g, b));
                }
            }

            var userPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            var fileName = Path.ChangeExtension(Path.GetRandomFileName(), "png");
            var outPath  = Path.Combine(userPath, fileName);

            bmp.Save(outPath);

            if (
                MessageBox.Show(String.Format("Die Ausgabedatei wurde unter {0} abgelegt. Öffnen?", outPath), "Fertig.",
                                MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                System.Diagnostics.Process.Start(outPath);
            }
        }
Exemple #19
0
 public FrmBurstActivityVisu(FtTransmitterDataset dataset, Color noDataColor)
 {
     InitializeComponent();
     this.Text = String.Format(this.Text, dataset.TagId);
     accVisualizer1.Setdata(noDataColor, dataset.AccelData.CalculatedActivities);
 }
        private String CreateTreeViewNodeDescriptor(FtTransmitterDataset dataset)
        {
            string fmt = "{0} ({1})";

            return(String.Format(fmt, dataset.TagId, dataset.GPSData.GpsSeries.GetLatestGpsDataEntry().StartTimestamp));
        }
 public DataChangedEventArgs(FtTransmitterDataset dataset, FtDatasetFeatureType changedFeatureTypeType)
 {
     Dataset     = dataset;
     FeatureType = changedFeatureTypeType;
 }
        public FtPuntualVectorLayer(FtMap ftMap, FtTransmitterDataset dataset)
        {
            _ftMap = ftMap;

            IProvider dataSource = null;
            var       symbolizer = dataset.Visulization.Symbolizer;

            var pointSymbolizer = symbolizer as IPointSymbolizer;

            if (pointSymbolizer != null)
            {
                dataSource      = dataset.GPSData.AsDataTablePoint();
                SymbolizerLayer = new VectorLayer(dataset.TagId.ToString(), dataSource)
                {
                    Style = { PointSymbolizer = pointSymbolizer }
                };

                pointSymbolizer.Size = new Size(Properties.Settings.Default.VisualizerMarkersize,
                                                Properties.Settings.Default.VisualizerMarkersize);
            }

            var lineSymbolizer = symbolizer as FtBasicLineSymbolizer;

            if (lineSymbolizer != null)
            {
                dataSource      = dataset.GPSData.AsDataTableLine();
                SymbolizerLayer = new VectorLayer(dataset.TagId.ToString(), dataSource)
                {
                    Style = { LineSymbolizer = lineSymbolizer }
                };

                lineSymbolizer.Size = new Size(Properties.Settings.Default.VisualizerMarkersize,
                                               Properties.Settings.Default.VisualizerMarkersize);
            }

            SymbolizerLayer.SmoothingMode = SmoothingMode.HighQuality;
            symbolizer.SmoothingMode      = SmoothingMode.HighQuality;

            if (dataSource?.GetFeatureCount() > 500)
            {
                SymbolizerLayer.SmoothingMode = SmoothingMode.HighSpeed;
                symbolizer.SmoothingMode      = SmoothingMode.HighSpeed;
            }

            if ((symbolizer as IFtBaseSymbolizer).Labeled)
            {
                LabelLayer = new LabelLayer($"Label{dataset.TagId}")
                {
                    DataSource            = dataset.GPSData.AsDataTablePoint(),
                    LabelColumn           = "num",
                    LabelPositionDelegate = LabelPositionDelegate,
                    SmoothingMode         = SmoothingMode.HighSpeed,
                    Style = { Font = MapFont, VerticalAlignment = LabelStyle.VerticalAlignmentEnum.Top, HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Left, CollisionDetection = false, ForeColor = dataset.Visulization.Color }
                };
            }
            if (LabelLayer != null)
            {
                this.Add(LabelLayer);
            }
            this.Add(SymbolizerLayer);
        }
 public void SetIntervalFilter(FtTransmitterDataset dataset, DateTime start, DateTime stop)
 {
     dataset.GPSData.SetIntervalFilter(start, stop);
     DataChangedEventHandler(this, new DataChangedEventArgs(dataset, FtDatasetFeatureType.Puntual));
 }
 public TreeNodeTagObject(TreeViewNodeType nodeType, FtTransmitterDataset nodeDataset, object nodeDatasetSubObject = null)
 {
     NodeType             = nodeType;
     NodeDataset          = nodeDataset;
     NodeDatasetSubObject = nodeDatasetSubObject;
 }