Beispiel #1
0
        protected void AddPolygon(int id, List <PointF> points, string layer, Color color)
        {
            if (points == null || points.Count == 0)
            {
                return;
            }

            var poly = new Polygon(id.ToString("#0"), StyleFactory.GetPointFromColor(color));

            for (var i = 0; i < points.Count; i++)
            {
                poly.AddPoint(new Point(i.ToString("#0"), points[i].X, points[i].Y));
            }

            Monitor.AddGeometries(layer, poly);
            Monitor.SetCenter(points.Last().Y, points.Last().X);
        }
        private void AddMessageWithElapsedTime(Infraccion mobileEvent, IEnumerable <List <RoutePosition> > routes)
        {
            var positions = GetMessagePositions(mobileEvent, routes);

            var line = new Line(mobileEvent.Fecha.ToString(), StyleFactory.GetRedLine());

            line.AddPoint(new Point(mobileEvent.Fecha.ToString(), mobileEvent.Longitud, mobileEvent.Latitud));

            for (var i = 0; i < positions.Count; i++)
            {
                line.AddPoint(new Point(i.ToString("#0"), positions[i].Longitude, positions[i].Latitude));
            }

            line.AddPoint(new Point(mobileEvent.FechaFin.Value.ToString(), mobileEvent.LongitudFin, mobileEvent.LatitudFin));

            Monitor.AddGeometries(Layers.MensajesDuracion, line);
        }
Beispiel #3
0
        private void ShowRecorrido(bool recalcularValores)
        {
            monitor.ClearLayer(LayerRecorrido);
            var count = lstAsignadas.Items.Count;

            if (count > 1)
            {
                var primero   = DAOFactory.PuntoEntregaDAO.FindById(Convert.ToInt32(lstAsignadas.Items[0].Value));
                var ultimo    = DAOFactory.PuntoEntregaDAO.FindById(Convert.ToInt32(lstAsignadas.Items[count - 1].Value));
                var origen    = new LatLon(primero.ReferenciaGeografica.Latitude, primero.ReferenciaGeografica.Longitude);
                var destino   = new LatLon(ultimo.ReferenciaGeografica.Latitude, ultimo.ReferenciaGeografica.Longitude);
                var waypoints = new List <LatLon>();
                for (int i = 1; i < count - 1; i++)
                {
                    var punto    = DAOFactory.PuntoEntregaDAO.FindById(Convert.ToInt32(lstAsignadas.Items[i].Value));
                    var waypoint = new LatLon(punto.ReferenciaGeografica.Latitude, punto.ReferenciaGeografica.Longitude);
                    waypoints.Add(waypoint);
                }

                var directions = GoogleDirections.GetDirections(origen, destino, GoogleDirections.Modes.Driving, string.Empty, waypoints.ToArray());
                var posiciones = directions.Legs.SelectMany(l => l.Steps.SelectMany(s => s.Points));
                var line       = new Line("D:" + Color.Red.ToArgb(), StyleFactory.GetLineFromColor(Color.Red, 4, 0.5));
                line.AddPoints(posiciones.Select(p => new Point("", p.Longitud, p.Latitud)));

                Points.Set(posiciones.Select(p => new PointF((float)p.Longitud, (float)p.Latitud)).ToList());

                monitor.AddGeometries(LayerRecorrido, line);

                if (recalcularValores)
                {
                    var ts = directions.Duration;
                    txtHoras.Text = ((int)Math.Truncate(ts.TotalHours)).ToString("00") + ":" + ((int)(ts.Minutes)).ToString("00") + ":" + ((int)(ts.Seconds)).ToString("00");
                    txtKm.Text    = (directions.Distance / 1000.00).ToString("#0.00");
                }
            }
            else
            {
                if (recalcularValores)
                {
                    txtHoras.Text = "00:00:00";
                    txtKm.Text    = "0.00";
                }
            }
        }
Beispiel #4
0
    public MainMenu()
    {
        style      = new StyleFactory("gui/default.xml");
        background = new Box(new Rect(0, 0, 640, 480), "gui/back.tga");

        WindowManager.Get().UnregisterAll();

        window = new Window(new Rect(180, 200, 460, 400), "Chess# v1.0", style);
        WindowManager.Get().RegisterWindow(window);

        btnGameCPU           = new Button(window, new Rect(12, 32, 268, 64), "P1 vs AI", style);
        btnGameCPU.LeftDown += new EventHandler(OnButtonGameCPUDown);
        btnGame2             = new Button(window, new Rect(12, 96, 268, 128), "P1 vs P2", style);
        btnGame2.LeftDown   += new EventHandler(OnButtonGame2Down);
        btnExit              = new Button(window, new Rect(12, 160, 268, 192), "Exit", style);
        btnExit.LeftDown    += new EventHandler(OnButtonExitDown);

        select = true;
    }
        private void DrawMainWindow(int id)
        {
            if (!initted)
            {
                for (int i = 0; i < 10; i++)
                {
                    digits[i] = StyleFactory.GetTexture("Digit" + i.ToString());
                }
                colon   = StyleFactory.GetTexture("colon");
                minus   = StyleFactory.GetTexture("minus");
                initted = true;
            }
            GUILayout.BeginHorizontal();

            //public static void DrawTexture(Rect position, Texture image, ScaleMode scaleMode, bool alphaBlend, float imageAspect, Color color, float borderWidth, float borderRadius);

            GUI.DrawTexture(ScaleRect(new Rect(13, 41, 25, 27)), minus);

            GUI.DrawTexture(ScaleRect(new Rect(45, 14, 54, 77)), digits[0]);
            GUI.DrawTexture(ScaleRect(new Rect(98, 14, 54, 77)), digits[0]);


            GUI.DrawTexture(ScaleRect(new Rect(166, 28, 16, 51)), colon);


            GUI.DrawTexture(ScaleRect(new Rect(190, 14, 54, 77)), digits[0]);
            GUI.DrawTexture(ScaleRect(new Rect(247, 14, 54, 77)), digits[0]);

            GUI.DrawTexture(ScaleRect(new Rect(316, 28, 16, 51)), colon);


            int firstDigit  = _tick / 10;
            int secondDigit = _tick % 10;

            //seconds
            GUI.DrawTexture(ScaleRect(new Rect(342, 14, 54, 77)), digits[firstDigit]);
            GUI.DrawTexture(ScaleRect(new Rect(396, 14, 54, 77)), digits[secondDigit]);

            GUILayout.EndHorizontal();

            GUI.DragWindow();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SpreadsheetDocument"/> class.
        /// </summary>
        public SpreadsheetDocument()
        {
            TableCollection           = new TableCollection();
            Styles                    = new StyleCollection();
            m_styleFactory            = new StyleFactory(this);
            CommonStyles              = new StyleCollection();
            Content                   = new ContentCollection();
            _graphics                 = new List <Graphic>();
            FontList                  = new List <string>();
            EmbedObjects              = new List <EmbedObject>();
            TableCollection.Inserted += TableCollection_Inserted;
            TableCollection.Removed  += TableCollection_Removed;
            Content.Inserted         += Content_Inserted;
            Content.Removed          += Content_Removed;

            _customFiles            = new CustomFileCollection();
            _customFiles.Clearing  += CustomFiles_Clearing;
            _customFiles.Inserting += CustomFiles_Inserting;
            _customFiles.Removing  += CustomFiles_Removing;
        }
Beispiel #7
0
        /// <summary>
        /// Create a new TextDocument object.
        /// </summary>
        public TextDocument()
        {
            _fields        = new FieldsCollection();
            Content        = new ContentCollection();
            Styles         = new StyleCollection();
            m_styleFactory = new StyleFactory(this);
            CommonStyles   = new StyleCollection();
            FontList       = new List <string>();
            _graphics      = new List <Graphic>();

            _formCollection           = new ODFFormCollection();
            _formCollection.Clearing += FormsCollection_Clear;
            _formCollection.Removed  += FormsCollection_Removed;

            VariableDeclarations = new VariableDeclCollection();

            _customFiles            = new CustomFileCollection();
            _customFiles.Clearing  += CustomFiles_Clearing;
            _customFiles.Inserting += CustomFiles_Inserting;
            _customFiles.Removing  += CustomFiles_Removing;
        }
Beispiel #8
0
        //bool initialPos = false;
        protected virtual void OnEnterToState(KFSMState kfsmState)
        {
            if (FlightGlobals.ActiveVessel == null)
            {
                return;
            }
            Log.Info("OnEnterToState: InitialState");
            if (FlightGlobals.ActiveVessel.situation != Vessel.Situations.PRELAUNCH)
            {
                Machine.RunEvent("Finish");
            }

            _obj   = new GameObject("Helper");
            _dummy = _obj.AddComponent <DummyComponent>();

            StyleFactory.Scale = ConfigInfo.Instance.Scale;

            StyleFactory.Reload();

            _windowRect = CountDownMain.instance.saveLoadWinPos.initialWindow;
        }
        private void AddReferenciaGeografica(string layerPoi, string layerArea, ReferenciaGeografica dom, string popupContent)
        {
            if (dom.Poligono != null)
            {
                var center = dom.Poligono.FirstPoint;
                var col    = StyleFactory.GetPointFromColor(dom.Color.Color);
                var id     = dom.Id + "_GEO";

                if (dom.Poligono.Radio > 0)
                {
                    Monitor.AddGeometries(layerArea, new Point(id, center.X, center.Y, dom.Poligono.Radio, col));
                }
                else
                {
                    var points = dom.Poligono.ToPointFList();
                    var poly   = new Polygon(id, col);
                    for (var i = 0; i < points.Count; i++)
                    {
                        poly.AddPoint(new Point(id + "_" + i, points[i].X, points[i].Y));
                    }

                    Monitor.AddGeometries(layerArea, poly);
                }
            }

            if (dom.Direccion == null)
            {
                return;
            }

            var icono  = dom.Icono != null ? IconDir + dom.Icono.PathIcono : string.Empty;
            var marker = new Marker(dom.Id.ToString("#0"),
                                    icono,
                                    dom.Direccion.Latitud,
                                    dom.Direccion.Longitud,
                                    popupContent,
                                    DrawingFactory.GetSize(dom.Icono != null ? dom.Icono.Width : 0, dom.Icono != null ? dom.Icono.Height : 0), DrawingFactory.GetOffset(dom.Icono != null ? dom.Icono.OffsetX : 0, dom.Icono != null ? dom.Icono.OffsetY : 0));

            Monitor.AddMarkers(layerPoi, marker);
        }
Beispiel #10
0
        private void ToggleOn()
        {
            if (GravityTurnAPI.GravityTurnActive)
            {
                Debug.Log("ToggleOn, GravityturnActive");
                return;
            }
            StyleFactory.NullIt();
            StyleFactory.Reload();
            NASA_CountDown.Config.ConfigInfo.Instance.InitNewConfig();
            Log.Info("ToggleOn");
            if (!_machine.Started)
            {
                _machine.StartFSM("Init");
            }
            else
            {
                _machine.RunEvent("Init");
            }

            saveLoadWinPos.LoadWindowPositions();
        }
Beispiel #11
0
        private void AddPositions(IList <List <RoutePosition> > routes, Color color, string layerName)
        {
            RoutePosition lastPosition = null;

            for (var i = 0; i < routes.Count; i++)
            {
                if (routes[i].Count > 0)
                {
                    _fechasRecorridos.Add(routes[i][routes[i].Count - 1].Date);
                }

                var lineId    = i.ToString(CultureInfo.InvariantCulture);
                var routeLine = new Line(lineId, StyleFactory.GetLineFromColor(color));

                for (var j = 0; j < routes[i].Count; j++)
                {
                    var currentPosition = routes[i][j];
                    if (lastPosition != null)
                    {
                        if (currentPosition.EqualsPosition(lastPosition))
                        {
                            lastPosition = currentPosition;
                            continue;
                        }
                    }

                    routeLine.AddPoint(new Point(j.ToString(CultureInfo.InvariantCulture), currentPosition.Longitude, currentPosition.Latitude));
                    lastPosition = currentPosition;
                }

                Monitor.AddGeometries(layerName, routeLine);
            }

            _x = routes[0][0].Latitude;
            _y = routes[0][0].Longitude;

            Monitor.SetDefaultCenter(_x, _y);
        }
Beispiel #12
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (IsPostBack)
            {
                return;
            }

            var googleMapsEnabled = true;
            var usuario           = DAOFactory.UsuarioDAO.FindById(WebSecurity.AuthenticatedUser.Id);

            if (usuario != null && usuario.PorEmpresa && usuario.Empresas.Count == 1)
            {
                var empresa = usuario.Empresas.First() as Empresa;
                if (empresa != null)
                {
                    googleMapsEnabled = empresa.GoogleMapsEnabled;
                }
            }

            Monitor.Initialize(googleMapsEnabled);
            Monitor.AddLayers(LayerFactory.GetVector(LayerAsignados, true, StyleFactory.GetHandlePoint()));
            Monitor.AddLayers(LayerFactory.GetVector(LayerNoAsignados, true, StyleFactory.GetHandlePoint()));
        }
Beispiel #13
0
        private void AddPositions(IList <List <RoutePosition> > routes)
        {
            //var maxTimeBetweenPositions = TimeSpan.FromMinutes(15);
            //var maxDistanceBetweenPositions = 500;


            var colorGenerator = new ColorGenerator(new List <Color> {
                Color.Yellow, Color.Orange
            });
            //var subid = 1;
            RoutePosition lastPosition = null;

            for (var i = 0; i < routes.Count; i++)
            {
                if (routes[i].Count > 0)
                {
                    _fechasRecorridos.Add(routes[i][routes[i].Count - 1].Date);
                }

                var color     = colorGenerator.GetNextColor();
                var lineId    = i.ToString(CultureInfo.InvariantCulture);
                var routeLine = new Line(lineId, StyleFactory.GetLineFromColor(color));


                for (var j = 0; j < routes[i].Count; j++)
                {
                    var currentPosition = routes[i][j];
                    if (lastPosition != null)
                    {
                        if (currentPosition.EqualsPosition(lastPosition))
                        {
                            lastPosition = currentPosition;
                            continue;
                        }
                        //var tiempo = currentPosition.Date.Subtract(lastPosition.Date);
                        //if (tiempo > maxTimeBetweenPositions ||
                        //    Distancias.Loxodromica(lastPosition.Latitude, lastPosition.Longitude,
                        //    currentPosition.Latitude, currentPosition.Longitude) > maxDistanceBetweenPositions)
                        //{
                        //    Monitor.AddGeometries(_recorrido, routeLine);

                        //    routeLine = new Line(string.Format("{0}_{1}",lineId, (subid++)), StyleFactory.GetDottedLineFromColor(color));
                        //    routeLine.AddPoint(new Point(string.Format("{0}_{1}", lineId, (subid++)), lastPosition.Longitude, lastPosition.Latitude));
                        //    routeLine.AddPoint(new Point(string.Format("{0}_{1}", lineId, (subid++)), currentPosition.Longitude, currentPosition.Latitude));
                        //    Monitor.AddGeometries(_recorrido, routeLine);

                        //    routeLine = new Line(string.Format("{0}_{1}", lineId, (subid++)), StyleFactory.GetLineFromColor(color));
                        //}
                    }

                    routeLine.AddPoint(new Point(j.ToString(CultureInfo.InvariantCulture), currentPosition.Longitude, currentPosition.Latitude));
                    lastPosition = currentPosition;
                }

                Monitor.AddGeometries(Layers.Recorrido, routeLine);
            }

            _x = routes[0][0].Latitude;
            _y = routes[0][0].Longitude;

            Monitor.SetDefaultCenter(_x, _y);
        }
Beispiel #14
0
        private void DrawCircle(ReferenciaGeografica geocerca, Color color)
        {
            var point    = geocerca.Poligono.FirstPoint;
            var poligono = new Point(string.Format("POINT_{0}", geocerca.Id), point.X, point.Y, geocerca.Poligono.Radio, StyleFactory.GetPointFromColor(color));

            Monitor.AddGeometries(Layers.Geocercas, poligono);
        }
Beispiel #15
0
        private static TableCell ParseCell(
            XElement cellTag,
            BaseStyle rowStyle,
            IEnumerable <KeyValuePair <string, BaseStyle> > classes)
        {
            BaseStyle cellStyle;
            var       attrClass = cellTag.Attributes("class").FirstOrDefault();

            if (attrClass != null)
            {
                var cellClasses = GetStylesByClasses(classes, attrClass);
                cellStyle = StyleFactory.MergeStyles(rowStyle, cellClasses);
            }
            else
            {
                cellStyle = rowStyle;
            }

            string formula = null;

            var attrFormula = cellTag.Attributes("formula").FirstOrDefault();

            if (attrFormula != null)
            {
                formula = attrFormula.Value;
            }

            string numberFormat = null;

            var attrNumberFormat = cellTag.Attributes("number-format").FirstOrDefault();

            if (attrNumberFormat != null)
            {
                numberFormat = attrNumberFormat.Value;
            }

            string title = null;

            var attrTitle = cellTag.Attributes("title").FirstOrDefault();

            if (attrTitle != null)
            {
                title = attrTitle.Value;
            }

            int colspan = 0;

            var attrColspan = cellTag.Attributes("colspan").FirstOrDefault();

            if (attrColspan != null)
            {
                int.TryParse(attrColspan.Value, out colspan);
            }

            int rowspan = 0;

            var attrRowspan = cellTag.Attributes("rowspan").FirstOrDefault();

            if (attrRowspan != null)
            {
                int.TryParse(attrRowspan.Value, out rowspan);
            }

            var cell = new TableCell
            {
                Style = new CellStyle(cellStyle, formula, numberFormat, title, colspan, rowspan),
                Value = ProcessString(cellTag)
            };

            return(cell);
        }
Beispiel #16
0
		/// <summary>
		/// Create a new TextDocument object.
		/// </summary>
		public TextDocument()
		{
			this._fields = new FieldsCollection();
			this.Content			= new ContentCollection();
			this.Styles				= new StyleCollection();
			this.m_styleFactory       = new StyleFactory(this);
			this.CommonStyles		= new StyleCollection();
			this.FontList			= new ArrayList();
			this._graphics			= new ArrayList();
			
			this._formCollection = new ODFFormCollection();
			this._formCollection.Clearing += FormsCollection_Clear;
			this._formCollection.Removed += FormsCollection_Removed;

			this.VariableDeclarations = new VariableDeclCollection();
		}
Beispiel #17
0
        protected string GetColor(int nivel, bool locked)
        {
            var color = lvlSel.GetColorForLevel(nivel);

            return(StyleFactory.GetPolygonFromColor(color, locked ? Color.Red : Color.DarkGray));
        }
Beispiel #18
0
        protected List <Geometry> GeneratePuntos(ViajeDistribucion distribucion, Color color)
        {
            var geomList = new List <Geometry>();

            var entregas = distribucion.Detalles.Where(d => d.Linea == null);

            foreach (var entrega in entregas)
            {
                var punto = entrega.ReferenciaGeografica;
                if (punto != null)
                {
                    var radio = punto.Poligono != null && punto.Poligono.Radio > 0
                                    ? punto.Poligono.Radio : 100;
                    var geocerca = new Point("G:" + punto.Id, punto.Longitude, punto.Latitude, radio, StyleFactory.GetPointFromColor(color));
                    //var marker = MarkerFactory.CreateMarker("P:" + punto.Id, string.Empty, punto.Latitude, punto.Longitude, GetEntregaPopupContent(entrega.Id));

                    geomList.Add(geocerca);
                    //markerList.Add(marker);
                }
            }

            return(geomList);

            /*
             * if (markerList.Any())
             *  monitorPuntos.AddMarkers(LayerPuntos, markerList.ToArray());
             * if (geomList.Any())
             *  monitorPuntos.AddGeometries(LayerReferencias, geomList.ToArray());
             */
        }
Beispiel #19
0
 public Document(WordprocessingDocument docx)
 {
     _docx          = docx;
     _styleAccessor = StyleFactory.Default(docx.MainDocumentPart);
 }
Beispiel #20
0
        public GUIStyle Create()
        {
            var style = StyleFactory.CreateWithTextColor(EditorStyles.foldoutPreDrop, _textColor);

            return(style);
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="SpreadsheetDocument"/> class.
		/// </summary>
		public SpreadsheetDocument()
		{
			this.TableCollection			= new TableCollection();
			this.Styles						= new StyleCollection();
			this.m_styleFactory             = new StyleFactory(this);
			this.CommonStyles				= new StyleCollection();
			this.Content					= new ContentCollection();
			this._graphics					= new ArrayList();
			this.FontList					= new ArrayList();
			this.EmbedObjects               = new ArrayList ();
			this.TableCollection.Inserted	+= TableCollection_Inserted;
			this.TableCollection.Removed	+= TableCollection_Removed;
			this.Content.Inserted			+= Content_Inserted;
			this.Content.Removed			+= Content_Removed;
		}
Beispiel #22
0
 public GUIStyle Create()
 {
     return(StyleFactory.CreateBackground(_backgroundColor, _rolloverBackgroundColor));
 }