Esempio n. 1
0
        addPntGroup(string nameGroup)
        {
            PointGroup pntGrp = null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDb())
                {
                    if (_pointGroups.Contains(nameGroup))
                    {
                        ObjectId grpId = _pointGroups[nameGroup];
                        pntGrp = (PointGroup)tr.GetObject(grpId, OpenMode.ForRead);
                    }
                    else
                    {
                        ObjectId grpId = _pointGroups.Add(nameGroup);
                        pntGrp = (PointGroup)tr.GetObject(grpId, OpenMode.ForRead);
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Pnts.cs: line: 39", ex.Message));
            }
            finally
            {
            }
            return(pntGrp);
        }
Esempio n. 2
0
 public DiffFinder(int x, int y, int width, int height)
 {
     pointDiffs = new Dictionary <Tuple <Point, Point>, int>();
     colorDiffs = new Dictionary <Tuple <Point, Color>, int>();
     rect       = new Rectangle(x, y, width, height);
     group      = new PointGroup();
 }
Esempio n. 3
0
    private void SelectCurveType(LevelComponent inComponent, PointGroup inGroup, eCurveType inNewSelectedCurve)
    {
        eCurveType currentCurveType = inGroup.mCurveType;

        if (currentCurveType != inNewSelectedCurve)
        {
            // Determine the new point.
            switch (inNewSelectedCurve)
            {
            case eCurveType.Point:
                CutOrAddGroupPointsTo(inComponent, inGroup, 1);
                break;

            case eCurveType.Quadratic:
                CutOrAddGroupPointsTo(inComponent, inGroup, 3);
                break;

            case eCurveType.Cubic:
                CutOrAddGroupPointsTo(inComponent, inGroup, 4);
                break;
            }

            // Set it.
            inGroup.mCurveType = inNewSelectedCurve;
        }
    }
Esempio n. 4
0
        public static List <CogoPoint> GetCogoPoints(this PointGroup ptGroup)
        {
            CivilDocument civDoc = CivilApplication.ActiveDocument;

            return((from p in ptGroup.GetPointNumbers()
                    select civDoc.CogoPoints.GetPointByPointNumber(p).GetObject(OpenMode.ForRead) as CogoPoint).ToList());
        }
Esempio n. 5
0
 addPntRawDescToGroup(string namePnt, string nameGroup)
 {
     try
     {
         using (Transaction tr = BaseObjs.startTransactionDoc())
         {
             try
             {
                 if (_pointGroups.Contains(nameGroup))
                 {
                     ObjectId   grpId              = _pointGroups[nameGroup];
                     PointGroup pntGrp             = (PointGroup)tr.GetObject(grpId, OpenMode.ForWrite);
                     StandardPointGroupQuery query = new StandardPointGroupQuery();
                     query.IncludeRawDescriptions = string.Format("{0}*", nameGroup);
                     pntGrp.SetQuery(query);
                     pntGrp.Update();
                 }
             }
             catch (System.Exception ex)
             {
                 BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 243", ex.Message));
             }
             tr.Commit();
         }
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 250", ex.Message));
     }
 }
Esempio n. 6
0
    private void SpawnItemsInLevel(LevelComponent inLevelComponent, PointGroup inGroup)
    {
        RunnerItemManager runnerItemManager = RunnerItemManager.Instance;

        switch (inGroup.mSpawnType)
        {
        case eSpawnType.Coins:
        {
            SpawnCoinStrip(inLevelComponent, inGroup);
            break;
        }

        case eSpawnType.Hazards:
        {
            HazardItem newHazard = (HazardItem)runnerItemManager.GetRandomItemOfType(typeof(HazardItem), mCurrentLevelGroup.LevelGroupID);
            SpawnitemtAtRandomPointInGroup(inLevelComponent, inGroup, newHazard);
            break;
        }

        case eSpawnType.Items:
        {
            RunnerItem newItem = (RunnerItem)runnerItemManager.GetRandomItemOfType(typeof(RunnerItem), mCurrentLevelGroup.LevelGroupID);
            SpawnitemtAtRandomPointInGroup(inLevelComponent, inGroup, newItem);
            break;
        }
        }
    }
Esempio n. 7
0
 updatePntGroup(string strGroupName)
 {
     try
     {
         using (Transaction tr = BaseObjs.startTransactionDoc())
         {
             try
             {
                 if (_pointGroups.Contains(strGroupName))
                 {
                     ObjectId   grpId  = _pointGroups[strGroupName];
                     PointGroup pntGrp = (PointGroup)tr.GetObject(grpId, OpenMode.ForWrite);
                     pntGrp.Update();
                 }
             }
             catch (System.Exception ex)
             {
                 BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 339", ex.Message));
             }
             tr.Commit();
         }
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 346", ex.Message));
     }
 }
        private void overrideLabelsForPointsIn(ObjectId pointGroupId)
        {
            PointGroup group = pointGroupId.GetObject(OpenMode.ForWrite)
                               as PointGroup;

            group.IsPointLabelStyleOverridden = true;
        }
Esempio n. 9
0
 updatePntGroups()
 {
     try
     {
         using (Transaction tr = BaseObjs.startTransactionDoc())
         {
             try
             {
                 foreach (ObjectId id in _pointGroups)
                 {
                     PointGroup pg = (PointGroup)tr.GetObject(id, OpenMode.ForWrite);
                     pg.Update();
                 }
             }
             catch (System.Exception ex)
             {
                 BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 367", ex.Message));
             }
             tr.Commit();
         }
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 374", ex.Message));
     }
 }
        private void ButtonImport_OnClick(object sender, RoutedEventArgs e)
        {
            List <int> SelectedGroups = new List <int>();

            for (int i = 0; i < AvailableGroups.Count; i++)
            {
                foreach (var selectedItem in ListGroups.SelectedItems)
                {
                    if ((string)selectedItem == AvailableGroups[i])
                    {
                        SelectedGroups.Add(i);
                    }
                }
            }

            using (Stream SessionStream = File.OpenRead(SessionPath))
            {
                XPathDocument  Doc    = new XPathDocument(SessionStream);
                XPathNavigator Reader = Doc.CreateNavigator();
                Reader.MoveToRoot();

                int iGroup = 0;
                foreach (XPathNavigator groupNav in Reader.Select("//PointGroups/Group"))
                {
                    if (SelectedGroups.Contains(iGroup))
                    {
                        PointGroup NewGroup = new PointGroup
                        {
                            Name  = XMLHelper.LoadAttribute(groupNav, "Name", "Group " + (MainWindow.Options.Membrane.PointGroups.Count + 1)),
                            Size  = XMLHelper.LoadAttribute(groupNav, "Size", 10),
                            Color = ColorHelper.LoadAttribute(groupNav, "Color", ColorHelper.SpectrumColor(MainWindow.Options.Membrane.PointGroups.Count, 0.3f))
                        };
                        NewGroup.PointCloud.GLContext = MainWindow.Options.Viewport.GetControl();

                        foreach (XPathNavigator pointNav in groupNav.SelectChildren("Point", ""))
                        {
                            int          TriangleID = XMLHelper.LoadAttribute(pointNav, "ID", 0);
                            SurfacePoint NewPoint   = new SurfacePoint(OpenGLHelper.LoadAttribute(pointNav, "Position", new Vector3(0)),
                                                                       MainWindow.Options.Membrane.SurfaceMesh.Triangles[TriangleID < MainWindow.Options.Membrane.SurfaceMesh.Triangles.Count ? TriangleID : 0],
                                                                       OpenGLHelper.LoadAttribute(pointNav, "Barycentric", new Vector3(0)),
                                                                       XMLHelper.LoadAttribute(pointNav, "Offset", 0f),
                                                                       OpenGLHelper.LoadAttribute(pointNav, "Orientation", new Vector3(0)).X);
                            NewGroup.Points.Add(NewPoint);
                        }

                        MainWindow.Options.Membrane.PointGroups.Add(NewGroup);
                        NewGroup.IsVisible = XMLHelper.LoadAttribute(groupNav, "IsVisible", true);
                    }

                    iGroup++;
                }
            }

            if (SelectedGroups.Count > 0)
            {
                MainWindow.Options.Viewport.Redraw();
            }

            Close();
        }
Esempio n. 11
0
        public void SetPointGroup(PointGroup pg)
        {
            if (pg == null) // disable this control
            {
                this.Enabled = false;
                // some objects are rendered black even when this control is disabled,
                // so hide them as well
                this.CircleToAngleValueLabel.Visible  = false;
                this.CircleToRadiusValueLabel.Visible = false;
                this.CountValueLabel.Visible          = false;
                this.SamplePanel.Visible = false;
            }
            else
            {
                this.Enabled = true;
                this.CircleToAngleValueLabel.Visible  = true;
                this.CircleToRadiusValueLabel.Visible = true;
                this.CountValueLabel.Visible          = true;
                this.SamplePanel.Visible = true;

                this.ShapeComboBox.SelectedIndex = (int)pg.Shape;

                if (_editingFixedPoints)
                {
                    FixedPointsValuesUIntSeqControl.Sequence = new StringBuilder(K.GetStringOfUnsignedInts(pg.Value));
                    CountValueLabel.Text = pg.Value.Count.ToString();
                }
                else
                {
                    StartMomentUIntControl.UnsignedInteger = new StringBuilder(pg.StartMoment.ToString());
                    PlanetValueUIntControl.UnsignedInteger = new StringBuilder(pg.Value[0].ToString());
                }
                FromRadiusFloatControl.Float = new StringBuilder(pg.FromRadius.ToString());
                FromAngleFloatControl.Float  = new StringBuilder(pg.FromAngle.ToString());
                if (ShapeComboBox.SelectedIndex == (int)K.PointGroupShape.circle)
                {
                    CircleToRadiusValueLabel.Visible = true;
                    CircleToAngleValueLabel.Visible  = true;
                    ToRadiusFloatControl.Visible     = false;
                    ToAngleFloatControl.Visible      = false;
                    CircleToRadiusValueLabel.Text    = pg.FromRadius.ToString();
                    CircleToAngleValueLabel.Text     = (pg.FromAngle + 360f).ToString();
                }
                else
                {
                    CircleToRadiusValueLabel.Visible = false;
                    CircleToAngleValueLabel.Visible  = false;
                    ToRadiusFloatControl.Visible     = true;
                    ToAngleFloatControl.Visible      = true;
                    ToRadiusFloatControl.Float       = new StringBuilder(pg.ToRadius.ToString());
                    ToAngleFloatControl.Float        = new StringBuilder(pg.ToAngle.ToString());
                }
                RotationFloatControl.Float    = new StringBuilder(pg.RotateAngle.ToString());
                ShiftRadiusFloatControl.Float = new StringBuilder(pg.TranslateRadius.ToString());
                ShiftAngleFloatControl.Float  = new StringBuilder(pg.TranslateAngle.ToString());
                VisibleCheckBox.Checked       = pg.Visible;
                ColorComboBox.SelectedIndex   = (int)pg.Color;
            }
        }
Esempio n. 12
0
 public int GetNextPointNum(PointGroup currentGroup)
 {
     if (currentGroup != null)
     {
         return(currentGroup.mPoints.Count);
     }
     return(-1);
 }
Esempio n. 13
0
 public void DeletePointInfo(PointGroup inParentPointGroup, PointInfo inInfoToDelete)
 {
     if (mPointGroups.Contains(inParentPointGroup) &&
         inParentPointGroup.mPoints.Contains(inInfoToDelete))
     {
         inParentPointGroup.mPoints.Remove(inInfoToDelete);
     }
 }
Esempio n. 14
0
 public void DeletePointGroup(PointGroup inGroupToDelete)
 {
     // Remove the group from our list
     if (mPointGroups.Contains(inGroupToDelete))
     {
         mPointGroups.Remove(inGroupToDelete);
     }
 }
        private void customizePointGroup(ObjectId id)
        {
            PointGroup            group = id.GetObject(OpenMode.ForWrite) as PointGroup;
            CustomPointGroupQuery query = new CustomPointGroupQuery();

            query.QueryString = "RawDescription='WELL*'";
            group.SetQuery(query);
            group.UseCustomClassification(_classification);
        }
Esempio n. 16
0
 private static void AddPoint(Cell cell, Vector3 point)
 {
     if (!s_PointGroupsByCell.TryGetValue(cell, out PointGroup group))
     {
         group = new PointGroup();
         s_PointGroupsByCell.Add(cell, group);
     }
     group.AddPoint(point);
 }
Esempio n. 17
0
 public PointInfo AddNewPoint(PointGroup currentGroup, Vector3 inNewPoint)
 {
     if (currentGroup != null)
     {
         PointInfo newPoint = new PointInfo(inNewPoint);
         currentGroup.mPoints.Add(newPoint);
         return(newPoint);
     }
     return(null);
 }
        private void renumberPoints(PointGroup group, int baseNumber)
        {
            uint[] pointNumbers = group.GetPointNumbers();
            int    firstNumber  = (int)pointNumbers[0];
            int    factor       = baseNumber - firstNumber;

            _civildoc.CogoPoints.SetPointNumber(
                ToEnumerableObjectId(group.GetPointNumbers()), factor);
            group.Update();
        }
Esempio n. 19
0
        public async Task <int> Handle(CreatePointGroupCommand request, CancellationToken cancellationToken)
        {
            var entity = new PointGroup();

            entity.Title = request.Title;
            _context.GroupPoints.Add(entity);
            await _context.SaveChangesAsync(cancellationToken);

            return(entity.Id);
        }
Esempio n. 20
0
    private void CreateNewGroup(LevelComponent inSelectedLevel)
    {
        // Create new, blank data.
        // string defaultName = "ID" + inSelectedLevel.NextID;

        // PointGroup newGroup = new PointGroup(defaultName);
        PointGroup newGroup = new PointGroup();

        inSelectedLevel.SetPointGroupInfo(newGroup);
    }
Esempio n. 21
0
    static public float CalculateCurveLength(PointGroup inSpawnGroup)
    {
        if (inSpawnGroup.mCurveType == eCurveType.Quadratic && inSpawnGroup.mPoints.Count < 3)
        {
            Debug.LogError("Not enough points, fix it!");
            return(-1f);
        }
        if (inSpawnGroup.mCurveType == eCurveType.Cubic && inSpawnGroup.mPoints.Count < 4)
        {
            Debug.LogError("Not enough points, fix it!");
            return(-1f);
        }
        // Uhh.. Determine the length?
        Vector3 ptA = inSpawnGroup.mPoints[0].mPosition;
        Vector3 ptB = inSpawnGroup.mPoints[1].mPosition;
        Vector3 ptC = inSpawnGroup.mPoints[2].mPosition;
        Vector3 ptD = Vector3.zero;

        if (inSpawnGroup.mPoints.Count > 3)
        {
            ptD = inSpawnGroup.mPoints[3].mPosition;
        }

        float notExactLengthOfCurve = 0.0f;

        bool    bPastFirst   = false;
        Vector3 lastDTVector = Vector3.zero;

        for (int dt = 0; dt < 100; dt++)
        {
            float   currentDT = (float)dt / 100f;
            Vector3 currentDTVector;

            if (inSpawnGroup.mCurveType == eCurveType.Quadratic)
            {
                currentDTVector = CalculateQuadtraticPoint(currentDT, ptA, ptB, ptC);
            }
            else
            {
                currentDTVector = CalculateBezierPoint(currentDT, ptA, ptB, ptC, ptD);
            }

            if (bPastFirst)
            {
                notExactLengthOfCurve += Vector3.Distance(currentDTVector, lastDTVector);
            }
            else
            {
                bPastFirst = true;
            }
            lastDTVector = currentDTVector;
        }

        return(notExactLengthOfCurve);
    }
Esempio n. 22
0
    public PointGroup GetGroup(int index)
    {
        PointGroup pointGroup = null;

        try{
            pointGroup = mPointGroups[index];
        } catch (ArgumentOutOfRangeException e) {
            pointGroup = null;
        }
        return(pointGroup);
    }
 private void renumberPointsForGroup(string groupName, int baseNumber)
 {
     using (Transaction tr = startTransaction())
     {
         ObjectId   pointGroupId = getPointGroupIdByName(groupName);
         PointGroup group        = pointGroupId.GetObject(OpenMode.ForRead)
                                   as PointGroup;
         renumberPoints(group, baseNumber);
         tr.Commit();
     }
 }
        private void ButtonImport_OnClick(object sender, RoutedEventArgs e)
        {
            List<int> SelectedGroups = new List<int>();
            for (int i = 0; i < AvailableGroups.Count; i++)
            {
                foreach (var selectedItem in ListGroups.SelectedItems)
                    if ((string)selectedItem == AvailableGroups[i])
                        SelectedGroups.Add(i);
            }

            using (Stream SessionStream = File.OpenRead(SessionPath))
            {
                XPathDocument Doc = new XPathDocument(SessionStream);
                XPathNavigator Reader = Doc.CreateNavigator();
                Reader.MoveToRoot();

                int iGroup = 0;
                foreach (XPathNavigator groupNav in Reader.Select("//PointGroups/Group"))
                {
                    if (SelectedGroups.Contains(iGroup))
                    {
                        PointGroup NewGroup = new PointGroup
                        {
                            Name = XMLHelper.LoadAttribute(groupNav, "Name", "Group " + (MainWindow.Options.Membrane.PointGroups.Count + 1)),
                            Size = XMLHelper.LoadAttribute(groupNav, "Size", 10),
                            Color = ColorHelper.LoadAttribute(groupNav, "Color", ColorHelper.SpectrumColor(MainWindow.Options.Membrane.PointGroups.Count, 0.3f))
                        };
                        NewGroup.PointCloud.GLContext = MainWindow.Options.Viewport.GetControl();

                        foreach (XPathNavigator pointNav in groupNav.SelectChildren("Point", ""))
                        {
                            int TriangleID = XMLHelper.LoadAttribute(pointNav, "ID", 0);
                            SurfacePoint NewPoint = new SurfacePoint(OpenGLHelper.LoadAttribute(pointNav, "Position", new Vector3(0)),
                                                                     MainWindow.Options.Membrane.SurfaceMesh.Triangles[TriangleID < MainWindow.Options.Membrane.SurfaceMesh.Triangles.Count ? TriangleID : 0],
                                                                     OpenGLHelper.LoadAttribute(pointNav, "Barycentric", new Vector3(0)),
                                                                     XMLHelper.LoadAttribute(pointNav, "Offset", 0f),
                                                                     OpenGLHelper.LoadAttribute(pointNav, "Orientation", new Vector3(0)).X);
                            NewGroup.Points.Add(NewPoint);
                        }

                        MainWindow.Options.Membrane.PointGroups.Add(NewGroup);
                        NewGroup.IsVisible = XMLHelper.LoadAttribute(groupNav, "IsVisible", true);
                    }

                    iGroup++;
                }
            }

            if (SelectedGroups.Count > 0)
                MainWindow.Options.Viewport.Redraw();

            Close();
        }
        private void createPointGroup(string name, PointGroupQuery query)
        {
            if (_pointGroups.Contains(name))
            {
                return;
            }
            ObjectId   groupId = _pointGroups.Add(name);
            PointGroup group   = groupId.GetObject(OpenMode.ForRead)
                                 as PointGroup;

            group.SetQuery(query);
        }
 private ObjectId findGroup(string name)
 {
     foreach (ObjectId id in _civildoc.PointGroups)
     {
         PointGroup group = id.GetObject(OpenMode.ForRead)
                            as PointGroup;
         if (group.Name == name)
         {
             return(id);
         }
     }
     return(ObjectId.Null);
 }
 public void LoadPointGroup(PointGroup pg)
 {
     if (pg.Selected)
     {
         WebClient wc = new WebClient();
         wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(SharedLandmarksDownloadComplete);
         wc.DownloadStringAsync(new Uri("http://vanguide.cloudapp.net/Summaries/ShowForCommunityByActivity.json?page=0&page_size=100&nocache=" + Guid.NewGuid().ToString()), pg);
     }
     else
     {
         //unload all the children frm the map layer
         pg.RemovePinsFromLayer();
     }
 }
Esempio n. 28
0
 public  void LoadPointGroup(PointGroup pg)
 {
     if (pg.Selected)
     {
         WebClient client = new WebClient();
         client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(dataElement_DownloadStringCompleted);
         client.DownloadStringAsync(new Uri(pg.DataUrl), pg);
     }
     else
     {
         //unload all the children frm the map layer
         pg.RemovePinsFromLayer();
     }
 }
Esempio n. 29
0
        private static bool PointAreInBounds(PointGroup group, Point initialPoint, int width, int height)
        {
            bool inBounds = true;

            foreach (var point in group.Points)
            {
                if (point.X >= initialPoint.X + width || point.Y >= initialPoint.Y + height)
                {
                    inBounds = false;
                    break;
                }
            }

            return(inBounds);
        }
Esempio n. 30
0
        public ExportPoints(PointGroupCollection PointGroups, string SourceFile)
        {
            InitializeComponent();
            foreach (ObjectId group in PointGroups)
            {
                PointGroup pointGroup = (PointGroup)group.GetObject(OpenMode.ForRead);
                if (pointGroup.Name.ToLower() != "_all points" && pointGroup.Name.ToLower() != "no display")
                {
                    lbGroups.Items.Add(pointGroup.Name);
                }
            }

            FolderPath = SourceFile + "\\Comp";

            this.DialogResult = DialogResult.Cancel;
        }
Esempio n. 31
0
        static SkillBar()
        {
            initialOffset     = new Point(20, 26);
            cooldownSetPoints = new PointGroup(
                new Point(-17, 8),
                new Point(-23, 15),
                new Point(-7, 16)
                );

            colorDiffMinutesCooldowns = new Dictionary <int, int>()
            {
                { 56, 2 }, //Wolf
                { 12, 2 }, //Prayer of god's power
                { 38, 7 }, //Wilderness
            };
        }
        public IEnumerable <LinePointsGroup <Sale> > LinePointGroups()
        {
            var retrievers = new PointGroup <Sale>("Retrievers");

            retrievers.Add(new Sale("\"Golden\";\"2.000,00\";4;\"2018-01-01\""));
            retrievers.Add(new Sale("\"Golden\";\"5.000,00\";2;\"2018-01-01\""));
            retrievers.Add(new Sale("\"Golden\";\"2.000,00\";6;\"2018-01-01\""));

            yield return(new LinePointsGroup <Sale>(
                             new List <PointGroup <Sale> >
            {
                retrievers
            },
                             "Puppies"
                             ));
        }
Esempio n. 33
0
    private void CutOrAddGroupPointsTo(LevelComponent inComponent, PointGroup inGroup, int inNumPoints)
    {
        List <PointInfo> groupPoints = inGroup.mPoints;

        // Cut our points down to the given number
        while (groupPoints.Count > inNumPoints)
        {
            groupPoints.RemoveAt(groupPoints.Count - 1);
        }

        // Increment our points up to the given number
        while (groupPoints.Count < inNumPoints)
        {
            AddNewPoint(inComponent, inGroup);
        }
    }
Esempio n. 34
0
        /// <summary>
        /// Creates Point groups based on the groupSize value.MinxPosition,maxXPosition and groupSize is calculated for every iteration
        /// All the points which fall within the groupSize are grouped.Threshold area will be the distance from  minXPosition to maxXPosition
        /// and the process is continued till minXPosition not greater than Plotarea width.
        /// </summary>
        /// <param name="actualList">List containing actual number of points</param>
        /// <param name="plotXValueDistance">Width of the plot Area i.e XValue range </param>
        /// <param name="groupSize">An area within which all the points falling are grouped</param>
        /// <returns></returns>
        private static List<PointGroup> CreatePointGroups(List<Point> actualList, Double minXPosition, Double plotXValueDistance, Double threshold)
        {
            List<PointGroup> PointGroups = new List<PointGroup>();

            Double maxXPosition = 0;
            Double position = minXPosition;

            for (; position <= (minXPosition + plotXValueDistance); position = maxXPosition)
            {
                maxXPosition = position + threshold;

                PointGroup pointGroup = new PointGroup()
                {
                    dataPoints = (from point in actualList where point.XValue >= position && point.XValue <= maxXPosition select point).ToList()
                };

                PointGroups.Add(pointGroup);
            }

            return PointGroups;
        }
Esempio n. 35
0
 private void DrawFixedDots(PointGroup pointGroup, bool inputPoints)
 {
     if (pointGroup.Visible)
     {
         pointGroup.GetFixedPointWindowsPixelCoordinates(_fieldPanelCentreX, _fieldPanelCentreY, _scale);
         DrawDots(pointGroup, 0, inputPoints, true, true);
     }
 }
Esempio n. 36
0
 /// <summary>
 /// Creates a new fixed point group in the outputKrystal, and a new, corresponding combobox entry in the
 /// editor.
 /// The fixed point group's default shape and comboboxIndex properties are set, and the PointGroupParameter
 /// block updated accordingly.
 /// Finally, the appropriate ComboBox.SelectedIndex is set.
 /// </summary>
 /// <param name="inputGroup"></param>
 private void CreateNewFixedPointGroup(bool inputGroup)
 {
     PointGroup p = new PointGroup();
     if (inputGroup)
     {
         _expander.InputGamete.FixedPointGroups.Add(p);
         p.Shape = K.PointGroupShape.spiral; // default value for fixed input groups
         p.Color = K.DisplayColor.black;
         ComboBox.ObjectCollection existingGroups = FixedInputsComboBox.Items;
         string newGroupName = "Input Group " + (existingGroups.Count + 1).ToString();
         existingGroups.Add(newGroupName);
         // The following assignment to FixedInputsComboBox.SelectedIndex triggers an event handler.
         FixedInputsComboBox.SelectedIndex = _fixedInputPointsIndex = existingGroups.Count - 1;
     }
     else // output group
     {
         _expander.OutputGamete.FixedPointGroups.Add(p);
         p.Shape = K.PointGroupShape.circle; // default value for fixed output groups
         p.Color = K.DisplayColor.red; // default for output points
         ComboBox.ObjectCollection existingGroups = FixedOutputsComboBox.Items;
         string newGroupName = "Output Group " + (existingGroups.Count + 1).ToString();
         existingGroups.Add(newGroupName);
         // The following assignment to FixedInputsComboBox.SelectedIndex triggers an event handler.
         FixedOutputsComboBox.SelectedIndex = _fixedOutputPointsIndex = existingGroups.Count - 1;
     }
     this.PointGroupParameters.SetPointGroup(p);
 }
Esempio n. 37
0
        private void MapLayerAdded(PointGroup pg)
        {
            if (!pg.Loaded)
            {
                lock (m_pointGroupsLoading)
                    m_pointGroupsLoading.Enqueue(pg);

                if (m_thread != null)
                    if (m_thread.ThreadState == ThreadState.Stopped)
                        m_thread = null;

                if (m_thread == null)
                {
                    m_thread = new Thread(new ThreadStart(() =>
                        {
                            while (m_pointGroupsLoading.Count > 0)
                            {
                                PointGroup pgItem;
                                lock (m_pointGroupsLoading)
                                    pgItem = m_pointGroupsLoading.Dequeue();

                                DispatcherHelper.UIDispatcher.BeginInvoke(() =>
                                    {
                                        //update the loading
                                        this.LoadingText = string.Format("Loading {0} locations...",pgItem.Title);
                                        this.Loading = true;
                                    });

                                while (!pgItem.Loaded)
                                    Thread.Sleep(700);
                            }

                            DispatcherHelper.UIDispatcher.BeginInvoke(() =>this.Loading = false);
                        }));
                    m_thread.IsBackground = true;
                    m_thread.Name = "PGsLoadingThread";
                }

                try
                {
                    //Start the thread
                    m_thread.Start();
                }
                catch { }
            }
        }
Esempio n. 38
0
 /// <summary>
 /// An array of coordinates which control how the background line for planets is drawn.
 /// The number of points in this array is independent of the number of points in the point group,
 /// but the curve follows the other parameters.
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public PointF[] ConnectingLineCoordinates(PointGroup p)
 {
     PointGroup clone = p.Clone();
     clone.Count = 200;
     clone.GetFixedPointWindowsPixelCoordinates(_fieldPanelCentreX, _fieldPanelCentreY, _scale);
     return clone.WindowsPixelCoordinates;
 }
Esempio n. 39
0
        public PointGroup GetPointGroup()
        {
            PointGroup pGroup = new PointGroup();
            pGroup.Shape = (K.PointGroupShape)ShapeComboBox.SelectedIndex;

            if (_editingFixedPoints)
            {
                pGroup.Value = K.GetUIntList(FixedPointsValuesUIntSeqControl.Sequence.ToString());
                pGroup.Count = (uint) pGroup.Value.Count; // the number of values in the Value string
            }
            else
            {
                pGroup.StartMoment = uint.Parse(StartMomentUIntControl.UnsignedInteger.ToString());	// MidiMoments
                //if (pGroup.StartMoment == 0)
                //    pGroup.StartMoment = 1;
                pGroup.Value = K.GetUIntList(PlanetValueUIntControl.UnsignedInteger.ToString());
                //pGroup.Count = 1; // this value requires knowledge of the other pointGroups in the planet
            }

            pGroup.FromRadius = float.Parse(FromRadiusFloatControl.Float.ToString());
            pGroup.FromAngle = float.Parse(FromAngleFloatControl.Float.ToString());

            if (pGroup.Shape == K.PointGroupShape.circle)
            {
                pGroup.ToRadius = float.Parse(CircleToRadiusValueLabel.Text);
                pGroup.ToAngle = float.Parse(CircleToAngleValueLabel.Text);
            }
            else
            {
                pGroup.ToRadius = float.Parse(ToRadiusFloatControl.Float.ToString());
                pGroup.ToAngle = float.Parse(ToAngleFloatControl.Float.ToString());
            }
            pGroup.RotateAngle = float.Parse(RotationFloatControl.Float.ToString());
            pGroup.TranslateRadius = float.Parse(ShiftRadiusFloatControl.Float.ToString());
            pGroup.TranslateAngle = float.Parse(ShiftAngleFloatControl.Float.ToString());

            pGroup.Visible = VisibleCheckBox.Checked;
            pGroup.Color = (K.DisplayColor)ColorComboBox.SelectedIndex;
            return pGroup;
        }
Esempio n. 40
0
            /// <summary>
            /// Draws the dots of a point group. Use this function to draw planets. Use DrawFixedDots() to draw fixed dots.
            /// </summary>
            /// <param name="p">The point group</param>
            /// <param name="pointGroupIndex">For planets, this point group's index in the list of point groups. This argument is ignored when drawing fixed point groups.</param>
            /// <param name="inputPoints">Is this an input point?</param>
            /// <param name="fixedPoints">Is this a fixed point?</param>
            /// <param name="drawFinalDot">true if this is the last point group in a list of planet point groups. This argument is ignored when drawing fixed point groups.</param>
            private void DrawDots(PointGroup p, int pointGroupIndex, bool inputPoints, bool fixedPoints, bool drawFinalDot)
            {
                PointF[] points = p.WindowsPixelCoordinates; // these points are scaled and centred
                GetTheDotPen(p.Color);
                int dotsToDraw = points.Length;
                if (!drawFinalDot)
                    dotsToDraw--;

                float _dotOffset = (_dotSize - 1) / 2; // used by both input and output points!

                #region draw output points
                if (inputPoints == false) // output points
                {
                    float _ringOffset = (_ringSize - 1) / 2;
                    for (int i = 0; i < dotsToDraw; i++)
                    {
                        if (_pointMarkers.Count == 0) // editing mode
                        {
                            if (fixedPoints || (pointGroupIndex == 0 && i == 0)) // fixed points or the first dot of an output planet
                            {
                                DrawDot(_theDotPen, _theRingFillBrush, points[i].X - _ringOffset, points[i].Y - _ringOffset, _ringSize);
                                DrawLabel(points[i], p.Value[i].ToString());
                            }
                            else // subsequent dots of an output planet in editing mode
                            {
                                DrawDot(_unusedOutputPointsPen, _unusedOutputPointsPen.Brush, points[i].X - _dotOffset, points[i].Y - _dotOffset, _dotSize);
                            }
                        }
                        else // time-slice mode
                        {
                            bool drawn = false;
                            foreach (PointMarker pm in _pointMarkers) // markers have been set for all fixed points
                                if (pm.PointF.Equals(points[i])) // the output point at this moment
                                {
                                    DrawDot(_theDotPen, _theRingFillBrush, points[i].X - _ringOffset, points[i].Y - _ringOffset, _ringSize);
                                    DrawLabel(points[i], pm.PointValue);
                                    drawn = true;
                                    break;
                                }
                            if (!drawn) // output planet points at other moments
                            {
                                DrawDot(_unusedOutputPointsPen, _unusedOutputPointsPen.Brush, points[i].X - _dotOffset, points[i].Y - _dotOffset, _dotSize);
                            }
                        }
                    }
                }
                #endregion
                #region draw input points
                else // inputPoints == true
                {
                    for (int i = 0; i < dotsToDraw; i++)
                    {
                        if (_pointMarkers.Count == 0) // editing mode
                        {
                            if (fixedPoints) // fixed input points
                            {
                                DrawDot(_theDotPen, _theDotPen.Brush, points[i].X - _dotOffset, points[i].Y - _dotOffset, _dotSize);
                                DrawLabel(points[i], p.Value[i].ToString());
                            }
                            else // input planet in editing mode
                            {
                                if (pointGroupIndex == 0 && i == 0)
                                    DrawLabel(points[i], p.Value[i].ToString());
                                if (p.Value[0] == _strandNodeList[i + ((int)p.StartMoment) - 1].strandPoint)
                                {
                                    DrawDot(_theDotPen, _theDotPen.Brush, points[i].X - _dotOffset, points[i].Y - _dotOffset, _dotSize);
                                }
                                else // unused dots of an input planet in editing mode
                                {
                                    DrawDot(_unusedInputPointsPen, _unusedInputPointsPen.Brush, points[i].X - _dotOffset, points[i].Y - _dotOffset, _dotSize);
                                }
                            }
                        }
                        else // time-slice mode
                        {
                            bool pointDrawn = false;
                            foreach (PointMarker pm in _pointMarkers) // markers have been set for all fixed points
                                if (pm.PointF.Equals(points[i])) // the input point at this moment
                                {
                                    if (fixedPoints) // all fixed points are marked in time-slice mode!
                                    {
                                        DrawDot(_theDotPen, _theDotPen.Brush, points[i].X - _dotOffset, points[i].Y - _dotOffset, _dotSize);
                                        DrawLabel(points[i], p.Value[i].ToString());
                                        pointDrawn = true;
                                    }
                                    else // marked planet point in time-slice mode
                                        DrawLabel(points[i], p.Value[0].ToString());
                                    break;
                                }
                            if (!pointDrawn) // unmarked input planet points in time-slice mode
                            {
                                if (p.Value[0] == _strandNodeList[i + ((int)p.StartMoment) - 1].strandPoint)
                                {
                                    DrawDot(_theDotPen, _theDotPen.Brush, points[i].X - _dotOffset, points[i].Y - _dotOffset, _dotSize);
                                }
                                else // unused dots of an input planet in editing mode
                                {
                                    DrawDot(_unusedInputPointsPen, _unusedInputPointsPen.Brush, points[i].X - _dotOffset, points[i].Y - _dotOffset, _dotSize);
                                }
                            }
                            else  // marked input planet points in time-slice mode (drawn on top of planet path)
                            {
                                DrawDot(_theDotPen, _theDotPen.Brush, points[i].X - _dotOffset, points[i].Y - _dotOffset, _dotSize);
                            }
                        }
                    }
                }
                #endregion
            }
Esempio n. 41
0
        public void SetPointGroup(PointGroup pg)
        {
            if (pg == null) // disable this control
            {
                this.Enabled = false;
                // some objects are rendered black even when this control is disabled,
                // so hide them as well
                this.CircleToAngleValueLabel.Visible = false;
                this.CircleToRadiusValueLabel.Visible = false;
                this.CountValueLabel.Visible = false;
                this.SamplePanel.Visible = false;
            }
            else
            {
                this.Enabled = true;
                this.CircleToAngleValueLabel.Visible = true;
                this.CircleToRadiusValueLabel.Visible = true;
                this.CountValueLabel.Visible = true;
                this.SamplePanel.Visible = true;

                this.ShapeComboBox.SelectedIndex = (int)pg.Shape;

                if (_editingFixedPoints)
                {
                    FixedPointsValuesUIntSeqControl.Sequence = new StringBuilder( K.GetStringOfUnsignedInts(pg.Value));
                    CountValueLabel.Text = pg.Value.Count.ToString();
                }
                else
                {
                    StartMomentUIntControl.UnsignedInteger = new StringBuilder(pg.StartMoment.ToString());
                    PlanetValueUIntControl.UnsignedInteger = new StringBuilder(pg.Value[0].ToString());
                }
                FromRadiusFloatControl.Float = new StringBuilder(pg.FromRadius.ToString());
                FromAngleFloatControl.Float = new StringBuilder(pg.FromAngle.ToString());
                if (ShapeComboBox.SelectedIndex == (int)K.PointGroupShape.circle)
                {
                    CircleToRadiusValueLabel.Visible = true;
                    CircleToAngleValueLabel.Visible = true;
                    ToRadiusFloatControl.Visible = false;
                    ToAngleFloatControl.Visible = false;
                    CircleToRadiusValueLabel.Text = pg.FromRadius.ToString();
                    CircleToAngleValueLabel.Text = (pg.FromAngle + 360f).ToString();
                }
                else
                {
                    CircleToRadiusValueLabel.Visible = false;
                    CircleToAngleValueLabel.Visible = false;
                    ToRadiusFloatControl.Visible = true;
                    ToAngleFloatControl.Visible = true;
                    ToRadiusFloatControl.Float = new StringBuilder(pg.ToRadius.ToString());
                    ToAngleFloatControl.Float = new StringBuilder(pg.ToAngle.ToString());
                }
                RotationFloatControl.Float = new StringBuilder(pg.RotateAngle.ToString());
                ShiftRadiusFloatControl.Float = new StringBuilder(pg.TranslateRadius.ToString());
                ShiftAngleFloatControl.Float = new StringBuilder(pg.TranslateAngle.ToString());
                VisibleCheckBox.Checked = pg.Visible;
                ColorComboBox.SelectedIndex = (int)pg.Color;
            }
        }
Esempio n. 42
0
 private void DrawConnectingLine(PointGroup p)
 {
     if (p.Visible)
     {
         PointF[] connectingLineCoordinates = ConnectingLineCoordinates(p);
         GetTheLinePen(p.Color);
         if (p.Shape == K.PointGroupShape.circle)
             _g.DrawClosedCurve(_theDottedLinePen, connectingLineCoordinates);
         else
             _g.DrawCurve(_theDottedLinePen, connectingLineCoordinates);
     }
 }