internal override XElement CreateXml() { var xRoot = new XElement(XmlConstants.Brick); xRoot.SetAttributeValue(XmlConstants.Type, XmlConstants.XmlPlaceAtBrickType); var xElementY = YPosition.CreateXml(); xElementY.SetAttributeValue(XmlConstants.Category, XmlConstants.YPosition); var xElementX = XPosition.CreateXml(); xElementX.SetAttributeValue(XmlConstants.Category, XmlConstants.XPosition); var xFormulalist = new XElement(XmlConstants.FormulaList); xFormulalist.Add(xElementY); xFormulalist.Add(xElementX); xRoot.Add(xFormulalist); return(xRoot); }
private Bitmap GeneratePartialBitmap(Geometries.Point center, XPosition xPos, YPosition yPos) { double x = center.X, y = center.Y; switch (xPos) { case XPosition.Right: x += m_Map.Envelope.Width; break; case XPosition.Left: x -= m_Map.Envelope.Width; break; } switch (yPos) { case YPosition.Top: y += m_Map.Envelope.Height; break; case YPosition.Bottom: y -= m_Map.Envelope.Height; break; } m_Map.Center = new Geometries.Point(x, y); return(m_Map.GetMap() as Bitmap); }
/// <summary> /// this is the execution method which gets executed later /// to get more arguments use the internal regArgs variable /// </summary> /// <param name="arg1">first argument after the command in the string</param> /// <param name="arg2">second argument after the command in the string</param> /// <param name="arg3">third argument after the command in the string</param> /// <param name="arg4">fourth argument after the command in the string</param> /// <returns>remember to set the command result in every return case</returns> public override CommandResult Execute(String arg1, String arg2, String arg3, String arg4) { Server.SendExecuteResponse(TriggerPlayer, ClientUser.LastEntityId.ToString()); PacketGenerator gen = new PacketGenerator(); gen.Add(ClientUser.LastEntityId); gen.Add(100); gen.Add(1000); gen.Add(100); gen.Add((byte)0); gen.Add((byte)0); ClientSocket c = Client as ClientSocket; (Server as ServerSocket).SendPacketToClient(PacketBytes._0x22_EntityTeleport_0x22, TriggerPlayer, gen.ToByteArray()); XPosition pos = Client.Position; PacketGenerator teleportData = new PacketGenerator(); teleportData.Add(100.0); // X teleportData.Add(999.5); // Y teleportData.Add(1000.0); // Stance teleportData.Add(100.0); // Z teleportData.Add(pos.Rotation); teleportData.Add(pos.Pitch); teleportData.Add(pos.Unkown); Client.SendPacket(Vitt.Andre.TCPTunnelLib.Vitt.Andre.Tunnel.PacketBytes._0x0D_PlayerMoveAndLook_0x0D, teleportData.ToByteArray()); (Server as ServerSocket).SendPacketToClient(PacketBytes._0x22_EntityTeleport_0x22, TriggerPlayer, gen.ToByteArray()); return(new CommandResult(true, string.Format("{0} executed by {1}", Name, TriggerPlayer))); }
private static StringAlignment PositionToAlignment(XPosition xPosition) { switch (xPosition) { case XPosition.Left: return StringAlignment.Near; case XPosition.Right: return StringAlignment.Far; default: throw new ArgumentException($"Unknown XPosition {(int)xPosition}"); } }
private static float OffsetToCoordinate(float xOffset, XPosition xPosition, int width) { switch (xPosition) { case XPosition.Left: return xOffset; case XPosition.Right: return width - xOffset; default: throw new ArgumentException($"Unknown XPosition {(int)xPosition}"); } }
public override void LoadReference() { if (XPosition != null) { XPosition.LoadReference(); } if (YPosition != null) { YPosition.LoadReference(); } }
public Zone GetZoneByPosition(XPosition x) { foreach (Zone z in this.Items) { if (z.ZonePointIntersection(z.Position1, z.Position2, x)) { return(z); } } return(null); }
/// <summary> /// Writes text on to an image using some default options. /// </summary> /// <param name="image">The image to be written on.</param> /// <param name="text">The text to be written.</param> /// <param name="xPosition">The vertical side of the image relative to which the text is written.</param> /// <param name="yPosition">The horizontal side of the image relative to which the text is written.</param> /// <param name="xOffset">The x offset relative to the vertical side.</param> /// <param name="yOffset">The y offset relative to the horizontal side.</param> /// <param name="emSize">The em size of the text to be written.</param> /// <param name="brush">A brush to be used for writing to specify the colour for example.</param> public static void WriteString(this Image image, string text, XPosition xPosition, YPosition yPosition, float xOffset, float yOffset, float emSize, Brush brush) { var graphic = Graphics.FromImage(image); graphic.WriteString(text, OffsetToCoordinate(xOffset, xPosition, image.Width), OffsetToCoordinate(yOffset, yPosition, image.Height), emSize, brush, PositionToAlignment(xPosition), PositionToAlignment(yPosition)); graphic.Flush(); }
public bool ZonePointIntersection(XPosition p1, XPosition p2, XPosition value) { if (p1.X > p2.X) { double temp = p1.X; p1.X = p2.X; p2.X = temp; } if (p1.Y > p2.Y) { double temp = p1.Y; p1.Y = p2.Y; p2.Y = temp; } if (p1.Z > p2.Z) { double temp = p1.Z; p1.Z = p2.Z; p2.Z = temp; } //ZoneSwapPos(ref p1,ref p2); double width = p1.X - p2.X; double height = p1.Z - p2.Z; if (value.X > p1.X && value.X < p2.X) { if (value.Z > p1.Z && value.Z < p2.Z) { if (value.Y > p1.Y && value.Y < p2.Y) { return(true); } } } return(false); }
public DomainResult Validate() { var errors = new List <string>(); // IsInSymmetricRange is an extension method if (!XPosition.IsInSymmetricRange(0, 999)) { errors.Add("The X Position must be within the range of 0 - 999"); } if (!YPosition.IsInSymmetricRange(0, 999)) { errors.Add("The Y Position must be within the range of 0 - 999"); } if (!Width.IsInSymmetricRange(1, 999)) { errors.Add("The Width must be within the range of 1 - 999"); } if (!Width.IsInCanvasBounds(XPosition, 1000)) { errors.Add("The sum of the Width and X Position must not be greater than canvas size of 1000"); } if (!Height.IsInSymmetricRange(0, 999)) { errors.Add("The Height must be within the range of 1 - 999"); } if (!Height.IsInCanvasBounds(YPosition, 1000)) { errors.Add("The sum of the Height and X Position must not be greater than canvas size of 1000"); } // ToValidationResult is an extension method var result = errors.ToValidationResult(); return(result); }
public void ZoneSwapPos(ref XPosition p1, ref XPosition p2) { double temp; if (p1.X > p2.X) { temp = p1.X; p1.X = p2.X; p2.X = temp; } if (p1.Y > p2.Y) { temp = p1.Y; p1.X = p2.Y; p2.Y = temp; } if (p1.Z > p2.Z) { temp = p1.Z; p1.Z = p2.Z; p2.Z = temp; } }
/// <summary> /// 复选框位置 /// </summary> /// <typeparam name="TComponent">组件类型</typeparam> /// <param name="component">组件实例</param> /// <param name="position">位置</param> public static TComponent CheckboxPosition <TComponent>(this TComponent component, XPosition position) where TComponent : ISelectList { var option = component as IOptionConfig; option?.Config <Config>(config => { config.SetAttribute(MaterialConst.CheckboxPosition, position); }); return(component); }
private Bitmap GeneratePartialBitmap(GeoPoint center, XPosition xPos, YPosition yPos) { double x = center.X, y = center.Y; switch (xPos) { case XPosition.Right: x += _map.Envelope.Width; break; case XPosition.Left: x -= _map.Envelope.Width; break; } switch (yPos) { case YPosition.Top: y += _map.Envelope.Height; break; case YPosition.Bottom: y -= _map.Envelope.Height; break; } _map.Center = new GeoPoint(x, y); return _map.GetMap() as Bitmap; }
public override int GetHashCode() { return(base.GetHashCode() ^ YPosition.GetHashCode() ^ XPosition.GetHashCode()); }
public void SetPoint(double x, double y, double z) { position1 = new XPosition(x, y, z, 0.0, 0.0f, 0.0f, false); }
public override string ToString() { return(XPosition.ToString() + ";" + YPosition.ToString() + ";"); }
public string Print() { return("Name: " + Name + " X: " + XPosition.ToString() + " Y: " + YPosition.ToString() + " Z: " + ZPosition.ToString()); }