//------------------------------------------------------------------------ // Picture Box Events //------------------------------------------------------------------------ private void M_pbMap_MouseMove(object sender, MouseEventArgs e) { String mouseCoord = String.Format("{0}:{1} - ", e.X, e.Y); try { if (m_dialogZoom != null) { PictureBox pbZoom = m_dialogZoom.GetPictureBox(); m_dialogZoom.SetImage(m_provinceEditor.ZoomImage(e.X, e.Y, pbZoom.Width / 2, pbZoom.Height / 2)); } Color pixelColor = m_provinceEditor.BitmapMapOverlay.GetPixel(e.X, e.Y); MarkerItem markerItem = m_provinceEditor.ListMarkerItem.Find(searchItem => (pixelColor.R == searchItem.R) && (pixelColor.G == searchItem.G) && (pixelColor.B == searchItem.B)); if (markerItem != null) { m_lblLoading.Text = mouseCoord + markerItem.Name; } else { m_lblLoading.Text = mouseCoord + ""; } } catch (Exception) { } }
private void PbMap_MouseMove(object sender, MouseEventArgs e) { string mouseCoord = $"{e.X}:{e.Y} - "; try { if (m_dialogZoom != null) { PictureBox pbZoom = m_dialogZoom.GetPictureBox(); m_dialogZoom.SetImage(m_provinceEditor.ZoomImage(e.X, e.Y, pbZoom.Width / 2, pbZoom.Height / 2)); } Color pixelColor = m_provinceEditor.BitmapMapOverlay.GetPixel(e.X, e.Y); MarkerItem markerItem = m_provinceEditor.MarkerItems.Find(searchItem => (pixelColor.R == searchItem.R) && (pixelColor.G == searchItem.G) && (pixelColor.B == searchItem.B)); if (markerItem != null) { m_lblLoading.Text = mouseCoord + markerItem.Name; } else { m_lblLoading.Text = mouseCoord + ""; } } finally { } }
private void CbMarker_SelectedIndexChanged(object sender, EventArgs e) { if (!(m_cbMarker.SelectedValue is MarkerItem markerItem)) { return; } m_provinceEditor.ChangeMarker(m_oldMarkerItem, markerItem); m_oldMarkerItem = markerItem; UpdateGui(); }
public void PlotTest() { plotSurface.Clear(); // can plot different types. ArrayList l = new ArrayList(); l.Add((int)2); l.Add((double)1.0); l.Add((float)3.0); l.Add((int)5.0); LinePlot lp1 = new LinePlot(new double[] { 4.0, 3.0, 5.0, 8.0 }); lp1.Pen = new Pen(Color.LightBlue); lp1.Pen.Width = 2.0f; //lp.AbscissaData = new StartStep( 0.0, 2.0 ); LinePlot lp2 = new LinePlot(new double[] { 2.0, 1.0, 4.0, 5.0 }); lp2.Pen = new Pen(Color.LightBlue); lp2.Pen.Width = 2.0f; FilledRegion fr = new FilledRegion(lp1, lp2); plotSurface.Add(fr); plotSurface.Add(new Grid()); plotSurface.Add(lp1); plotSurface.Add(lp2); ArrowItem a = new ArrowItem(new PointD(2, 4), -50.0f, "Arrow"); a.HeadOffset = 5; a.ArrowColor = Color.Red; a.TextColor = Color.Purple; plotSurface.Add(a); MarkerItem m = new MarkerItem(new Marker(Marker.MarkerType.TriangleDown, 8, Color.ForestGreen), 1.38, 2.9); plotSurface.Add(m); plotSurface.XAxis1.TicksCrossAxis = true; ((LinearAxis)plotSurface.XAxis1).LargeTickValue = -4.1; ((LinearAxis)plotSurface.XAxis1).AutoScaleText = true; ((LinearAxis)plotSurface.XAxis1).TicksIndependentOfPhysicalExtent = true; //plotSurface.XAxis1.Label = "Hello world"; plotSurface.Refresh(); }
/// <summary> /// Creates a Mark at the Ants Position. /// </summary> /// <param name="information">Information</param> /// <param name="size">Maxium Size</param> /// <returns>Succes Result</returns> public bool MakeMark(int information, float size) { // Wartezeit abwarten if (markerDelay > 0) { return(false); } // Marker erstellen var marker = new MarkerItem(Faction.Context, Faction, Item.Position.ToVector2XY(), size, information); Item.Engine.InsertItem(marker); markerDelay = Faction.Settings.GetInt <AntItem>("MarkerDelay").Value; return(true); }
private void M_pbMap_Click(object sender, EventArgs eventArgs) { MouseEventArgs mouseEventArgs = ( MouseEventArgs )eventArgs; MarkerItem markerItem = ( MarkerItem )m_cbMarker.SelectedValue; if (m_btnMarkProvinces.BackColor == Color.Silver) { m_provinceEditor.Mark(markerItem, mouseEventArgs.X, mouseEventArgs.Y); } else if (m_btnMarkLocation.BackColor == Color.Silver) { m_provinceEditor.MarkLocation(markerItem, mouseEventArgs.X, mouseEventArgs.Y); } else if (m_btnMarkOutgoing.BackColor == Color.Silver) { m_provinceEditor.MarkOutgoing(markerItem, mouseEventArgs.X, mouseEventArgs.Y); } UpdateGui(); }
public MarkerInfo(MarkerItem item, Item observer) : base(item, observer) { markerItem = item; }
protected override void RequestDraw() { if (_level != null) { DrawPlayground(_level.Map.GetCellCount(), _level.Map.Tiles); foreach (var item in _level.Items) { float?bodySpeed = null; float?bodyDirection = null; float?bodyRadius = null; float?smellableRadius = null; float?viewRange = null; float?viewAngle = null; float?viewDirection = null; float?attackRange = null; // Movement if (item.ContainsProperty <WalkingProperty>()) { WalkingProperty prop = item.GetProperty <WalkingProperty>(); bodySpeed = prop.Speed; bodyDirection = prop.Direction; } // Kollisionsradius if (item.ContainsProperty <CollidableProperty>()) { CollidableProperty prop = item.GetProperty <CollidableProperty>(); bodyRadius = prop.CollisionRadius; } // Sicht if (item.ContainsProperty <SightingProperty>()) { SightingProperty prop = item.GetProperty <SightingProperty>(); viewRange = prop.ViewRange; viewDirection = prop.ViewDirection.Radian; viewAngle = prop.ViewAngle; } // Attack if (item.ContainsProperty <AttackerProperty>()) { AttackerProperty prop = item.GetProperty <AttackerProperty>(); attackRange = prop.AttackRange; } // Stinkender radius if (item.ContainsProperty <SmellableProperty>()) { SmellableProperty prop = item.GetProperty <SmellableProperty>(); smellableRadius = prop.SmellableRadius; } Color color = Color.Gray; Color?borderColor = null; // Farbe if (item is AnthillItem) { color = Color.Brown; } else if (item is SugarItem) { color = Color.White; } else if (item is AppleItem) { color = Color.LightGreen; } else if (item is BugItem) { color = Color.Blue; } else if (item is AntItem) { color = Color.LightGray; AntItem ant = item as AntItem; switch (ant.PlayerIndex) { case 0: borderColor = Color.Orange; break; case 1: borderColor = Color.Red; break; case 2: borderColor = Color.Yellow; break; case 3: borderColor = Color.Green; break; case 4: borderColor = Color.Blue; break; case 5: borderColor = Color.Purple; break; case 6: borderColor = Color.White; break; case 7: borderColor = Color.Black; break; } } else if (item is MarkerItem) { color = Color.LightGray; MarkerItem marker = item as MarkerItem; switch (marker.PlayerIndex) { case 0: borderColor = Color.Orange; break; case 1: borderColor = Color.Red; break; case 2: borderColor = Color.Yellow; break; case 3: borderColor = Color.Green; break; case 4: borderColor = Color.Blue; break; case 5: borderColor = Color.Purple; break; case 6: borderColor = Color.White; break; case 7: borderColor = Color.Black; break; } } // Malen DrawItem(item.Id, item.Position, bodyRadius, bodyDirection, bodySpeed, color, viewRange, viewDirection, viewAngle, attackRange, smellableRadius, borderColor); } } }
public void CreatePlot(InteractivePlotSurface2D plotSurface) { plotSurface.Clear(); // can plot different types. ArrayList l = new ArrayList(); l.Add((int)2); l.Add((double)1.0); l.Add((float)3.0); l.Add((int)5.0); LinePlot lp1 = new LinePlot(new double[] { 4.0, 3.0, 5.0, 8.0 }); lp1.Pen = new Pen(Color.LightBlue); lp1.Pen.Width = 2.0f; //lp.AbscissaData = new StartStep( 0.0, 2.0 ); LinePlot lp2 = new LinePlot(new double[] { 2.0, 1.0, 4.0, 5.0 }); lp2.Pen = new Pen(Color.LightBlue); lp2.Pen.Width = 2.0f; FilledRegion fr = new FilledRegion(lp1, lp2); plotSurface.Add(fr); plotSurface.Add(new Grid()); plotSurface.Add(lp1); plotSurface.Add(lp2); ArrowItem a = new ArrowItem(new PointD(2, 4), -50.0f, "Arrow"); a.HeadOffset = 5; a.ArrowColor = Color.Red; a.TextColor = Color.Purple; plotSurface.Add(a); MarkerItem m = new MarkerItem(new Marker(Marker.MarkerType.TriangleDown, 8, Color.ForestGreen), 1.38, 2.9); plotSurface.Add(m); plotSurface.XAxis1.TicksCrossAxis = true; ((LinearAxis)plotSurface.XAxis1).LargeTickValue = -4.1; ((LinearAxis)plotSurface.XAxis1).AutoScaleText = true; ((LinearAxis)plotSurface.XAxis1).TicksIndependentOfPhysicalExtent = true; //plotSurface.XAxis1.Label = "Hello world"; plotSurface.Refresh(); /* * plotSurface.AutoScaleTitle = false; * plotSurface.AutoScaleAutoGeneratedAxes = true; * * plotSurface.Title = "My Title"; * * double[] a = { 0, 2, 1, 4, double.NaN, double.NaN, 5, 8, 7, 9 }; * LinePlot lp = new LinePlot(); * lp.DataSource = a; * lp.Label = "My Label"; * * plotSurface.Add( lp ); * * plotSurface.Legend = new Legend(); * plotSurface.Legend.AutoScaleText = false; * plotSurface.Legend.NeverShiftAxes = true; * plotSurface.Legend.HorizontalEdgePlacement = Legend.Placement.Inside; * plotSurface.Legend.VerticalEdgePlacement = Legend.Placement.Inside; * plotSurface.Legend.XOffset = -10; * plotSurface.Legend.YOffset = 10; * //plotSurface.AddAxesConstraint( new AxesConstraint.EqualSpacing() ); * * ((LinearAxis)plotSurface.XAxis1).Offset = 10.0; * ((LinearAxis)plotSurface.XAxis1).Scale = 27.0; * //((LinearAxis)plotSurface.XAxis1).TicksIndependentOfPhysicalExtent = true; * //((LinearAxis)plotSurface.YAxis1).TicksIndependentOfPhysicalExtent = true; * * AxesConstraint.AxisPosition c1 = * new Florence.AxesConstraint.AxisPosition( PlotSurface2D.YAxisPosition.Left, 100.0f ); * * AxesConstraint.AspectRatio c2 = * new AxesConstraint.AspectRatio( 5.0f, PlotSurface2D.YAxisPosition.Left ); * * plotSurface.AddAxesConstraint( c1 ); * plotSurface.AddAxesConstraint( c2 ); * * plotSurface.Refresh(); */ }