Exemplo n.º 1
0
        //select paint from list
        public void selectItem()
        {
            //Clicking on chossen Paint id
            PaintObject.Click();

            //Clicks on WhishList Button
            CommonUtilities.WaitForElement(Global.Base.driver, By.XPath("//span[text()='Add to Wish List']"), 20);
            ButtonWishList.Click();

            //For page down
            Actions action1 = new Actions(Global.Base.driver);

            action1.SendKeys(Keys.PageDown).Build().Perform();

            //let product add to cart
            Thread.Sleep(5000);



            //IList<IWebElement> listOfPaints= PaintObjects.FindElements(By.TagName("article"));
            // for(int i=0; i< listOfPaints.Count; i++)
            // {
            //     Console.WriteLine(listOfPaints[i].Text);
            //     if(listOfPaints[i].Text== Resource1.PaintID)
            //     {
            //         listOfPaints[i].Click();
            //         break;
            //     }
            //}
        }
Exemplo n.º 2
0
        public void InitializeStepScenario(ExperimentConfig cnfg)
        {
            _scenarioConfig = cnfg;
            currentTime     = cnfg.StartTime;
            int groupCount = agentGroups.Count;

            for (int i = 0; i < ServicesList.Count; i++)
            {
                if (ServicesList[i] is StopService)
                {
                    if ((ServicesList[i] as StopService).PassengersGroup != null)
                    {
                        groupCount++;
                    }
                }
                if (ServicesList[i] is TurnstileService)
                {
                    if ((ServicesList[i] as TurnstileService).TurnstileGeometry != null)
                    {
                        PaintObject obj = new PaintObject(ServicesList[i].Name);
                    }
                }
                ServicesList[i].Initialize();
            }
            _analisisViewModel = new AnalisisViewModel();

            _analisis = new AnalisisCollector(map.GetMap().GetLength(0), map.GetMap().GetLength(1), groupCount);

            if (GroupListeners != null)
            {
                foreach (var listener in GroupListeners.Values)
                {
                    listener.Stop();
                }
            }
            GroupListeners     = new Dictionary <int, TcpListener>();
            ServersSocketList  = new Dictionary <int, Socket>();
            agentsList         = new List <AgentBase>();
            AgentByStepCounter = new Dictionary <int, double>();
            for (int i = 0; i < agentGroups.Count; i++)
            {
                if (agentGroups[i].IsNetworkGroup)
                {
                    TcpListener tcpListener = new TcpListener(System.Net.IPAddress.Parse(agentGroups[i].Address), agentGroups[i].Port);
                    tcpListener.Start();
                    GroupListeners.Add(agentGroups[i].ID, tcpListener);
                    BackgroundWorker worker = new BackgroundWorker();
                    worker.DoWork += new DoWorkEventHandler(AcceptAgent_DoWork);
                    worker.RunWorkerAsync(agentGroups[i]);
                }
                else
                {
                    AgentByStepCounter.Add(agentGroups[i].ID, 0);
                }
            }
        }
Exemplo n.º 3
0
        public void MouseReleased(object sender, MouseButtonEventArgs e)
        {
            this.IsDragging = false;

            pointsGathered.Add(e.GetPosition(constructorListener.InputElement)); //1
            temporaryObject.define(pointsGathered);                              //1
            constructorListener.constructionComplete(temporaryObject);
            constructorListener.hoveringOverConstructionArea(null);              //

            pointsGathered  = null;
            temporaryObject = null;
        }
Exemplo n.º 4
0
        private void PaintMap(List <PaintObject> PaintObjectList)
        {
            pnlMap.Width  = scena.map.GetMap().GetLength(0) * Zoom;
            pnlMap.Height = scena.map.GetMap().GetLength(1) * Zoom;
            pnlMap.Children.Clear();

            pnlMap.Background = Brushes.Transparent;
            for (int n = 0; n < PaintObjectList.Count; n++)
            {
                PaintObject obj = PaintObjectList[n];
                if (obj.GetName() == "path")
                {
                    string         data  = obj.GetAttributeValue("data");
                    SVSObjectStyle style = obj.GetStyle();

                    Path path = new Path();
                    path.Data            = Geometry.Parse(data);
                    path.Fill            = new System.Windows.Media.SolidColorBrush(Color.FromArgb(style.FillColor.A, style.FillColor.R, style.FillColor.G, style.FillColor.B));
                    path.Stroke          = new System.Windows.Media.SolidColorBrush(Color.FromArgb(style.BorderColor.A, style.BorderColor.R, style.BorderColor.G, style.BorderColor.B));
                    path.StrokeThickness = (double)style.BorderSize;
                    System.Drawing.Drawing2D.Matrix m = obj.GetTransformMatrix();
                    Matrix matrix = new Matrix((double)m.Elements[0], (double)m.Elements[1], (double)m.Elements[2], (double)m.Elements[3], (double)m.OffsetX, (double)m.OffsetY);
                    matrix.Scale(Zoom, Zoom);
                    path.RenderTransform = new MatrixTransform(matrix);
                    pnlMap.Children.Add(path);
                }
                if (obj.GetName() == "rect")
                {
                    double         x     = PaintObject.StringToDoubleConvertor(obj.GetAttributeValue("x"));
                    double         y     = PaintObject.StringToDoubleConvertor(obj.GetAttributeValue("y"));
                    double         w     = PaintObject.StringToDoubleConvertor(obj.GetAttributeValue("width"));
                    double         h     = PaintObject.StringToDoubleConvertor(obj.GetAttributeValue("height"));
                    SVSObjectStyle style = obj.GetStyle();

                    Rectangle rect = new Rectangle();
                    rect.SetValue(Canvas.LeftProperty, x * Zoom);
                    rect.SetValue(Canvas.TopProperty, y * Zoom);
                    rect.Width           = w;
                    rect.Height          = h;
                    rect.Fill            = new System.Windows.Media.SolidColorBrush(Color.FromArgb(style.FillColor.A, style.FillColor.R, style.FillColor.G, style.FillColor.B));
                    rect.Stroke          = new System.Windows.Media.SolidColorBrush(Color.FromArgb(style.BorderColor.A, style.BorderColor.R, style.BorderColor.G, style.BorderColor.B));
                    rect.StrokeThickness = (double)style.BorderSize;
                    System.Drawing.Drawing2D.Matrix m = obj.GetTransformMatrix();
                    Matrix matrix = new Matrix((double)m.Elements[0], (double)m.Elements[1], (double)m.Elements[2], (double)m.Elements[3], (double)m.OffsetX, (double)m.OffsetY);
                    matrix.Scale(Zoom, Zoom);
                    rect.RenderTransform = new MatrixTransform(matrix);
                    pnlMap.Children.Add(rect);
                }
            }
        }
Exemplo n.º 5
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject != null)
     {
         PaintObject po = other.gameObject.GetComponent <PaintObject>();
         if (po != null)
         {
             if (!colors.Contains(po.colorString))
             {
                 colors.Add(po.colorString);
             }
         }
     }
 }
Exemplo n.º 6
0
        public void MousePressed(object sender, MouseButtonEventArgs e)
        {
            this.IsDragging = true;

            pointsGathered = new PointCollection();
            pointsGathered.Add(e.GetPosition(constructorListener.InputElement));

            try
            {
                temporaryObject = Activator.CreateInstance(paintObjectType) as PaintObject;
            }
            catch (Exception exception)
            {
                Console.WriteLine("Error creating paintObjectType: " + exception.Message);
            }

            temporaryObject.setColor(color);
            temporaryObject.setThickness(thickness);
            temporaryObject.define(pointsGathered);

            constructorListener.hoveringOverConstructionArea(makeHoveringPrototype(e.GetPosition(((IPaintObjectConstructorListener)constructorListener).InputElement))); //
            constructorListener.constructionBeginning(temporaryObject);
        }
Exemplo n.º 7
0
        private PaintObject makeHoveringPrototype(Point p)
        {
            PaintObject prototype = null;

            try
            {
                prototype = (PaintObject)Activator.CreateInstance(paintObjectType);
            }
            catch (Exception exception)
            {
                Console.WriteLine("Error creating paintObjectType error: " + exception.Message);
            }

            PointCollection points = new PointCollection(2);

            points.Add(p);
            points.Add(p); //
            prototype.define(points);
            prototype.setThickness(5);
            prototype.setColor(this.color);

            return(prototype);
        }
Exemplo n.º 8
0
 void Update()
 {
     if (Input.GetMouseButton(0))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hitInfo;
         if (Physics.Raycast(ray, out hitInfo))
         {
             currentObject = hitInfo.transform.GetComponent <PaintObject>();
             vertexObject  = hitInfo.transform.GetComponent <VertexPaint>();
             if (currentObject != null)
             {
                 currentObject.Paint(hitInfo, brush);
             }
             else
             {
                 if (vertexObject != null)
                 {
                     vertexObject.PaintUV(hitInfo.textureCoord);
                 }
             }
         }
     }
 }
Exemplo n.º 9
0
        private void PaintMap()
        {
            tbMapSize.Text = string.Format("{0}x{1}", scenario.Map.GetMap().GetLength(0), scenario.map.GetMap().GetLength(1));
            pnlMap.Width   = scenario.map.GetMap().GetLength(0);
            pnlMap.Height  = scenario.map.GetMap().GetLength(1);
            if (_showMapMask)
            {
                //ImageBrush brush = new ImageBrush(scenario.Image);
                ImageBrush brush = new ImageBrush(scenario.Map.GetLayerMask(0));
                pnlMap.Background = brush;
            }
            if (_showBackgroundImage)
            {
                try
                {
                    ImageBrush brush = new ImageBrush(new BitmapImage(new Uri(Properties.Settings.Default.ScenarioPath + "image.jpg")));
                    pnlMap.Background = brush;
                }
                catch
                {
                    pnlMap.Background = Brushes.LightPink;
                }
            }
            if ((_showBackgroundImage | _showMapMask) == false)
            {
                pnlMap.Background = Brushes.White;
            }

            for (int i = 0; i < pnlMap.Children.Count; i++)
            {
                if (!(pnlMap.Children[i] is Shape))
                {
                    pnlMap.Children.RemoveAt(i);
                    i--;
                }
            }
            if (_showWalls)
            {
                for (int n = 0; n < scenario.ServicesList.Count; n++)
                {
                    if (scenario.ServicesList[n] is TurnstileService)
                    {
                        var fig = (scenario.ServicesList[n] as TurnstileService).TurnstileGeometry;
                        System.Windows.Shapes.Path path = new System.Windows.Shapes.Path();
                        path.Data            = new PathGeometry(new PathFigure[] { fig });
                        path.Stroke          = Brushes.LightGray;
                        path.StrokeThickness = 2.0;
                        pnlMap.Children.Add(path);
                    }
                    if (scenario.ServicesList[n] is QueueService)
                    {
                        foreach (var point in (scenario.ServicesList[n] as QueueService).InputPoints)
                        {
                            System.Windows.Shapes.Rectangle rect = new System.Windows.Shapes.Rectangle();
                            rect.SetValue(Canvas.LeftProperty, (double)point.X - 1);
                            rect.SetValue(Canvas.TopProperty, (double)point.Y - 1);
                            rect.Width  = point.PointWidth * 2;
                            rect.Height = point.PointHeight * 2;
                            //rect.Stroke = Brushes.Pink;
                            rect.Fill = Brushes.LimeGreen;
                            //rect.StrokeThickness = 2.0D;
                            pnlMap.Children.Add(rect);
                        }
                    }
                }
                for (int n = 0; n < scenario.paintObjectList.Count; n++)
                {
                    PaintObject obj = scenario.paintObjectList[n];
                    if (obj.GetName() == "path")
                    {
                        string data = obj.GetAttributeValue("data");
                        System.Windows.Shapes.Path path = new System.Windows.Shapes.Path();
                        path.Data = Geometry.Parse(data);
                        SVSObjectStyle style = obj.GetStyle();
                        path.Fill   = new System.Windows.Media.SolidColorBrush(Color.FromArgb(style.FillColor.A, style.FillColor.R, style.FillColor.G, style.FillColor.B));
                        path.Stroke = new System.Windows.Media.SolidColorBrush(Color.FromArgb(style.BorderColor.A, style.BorderColor.R, style.BorderColor.G, style.BorderColor.B));
                        //path.Stroke = new System.Windows.Media.SolidColorBrush(Colors.Black);
                        path.StrokeThickness = (double)style.BorderSize;
                        System.Drawing.Drawing2D.Matrix m = obj.GetTransformMatrix();
                        Matrix matrix = new Matrix((double)m.Elements[0], (double)m.Elements[1], (double)m.Elements[2], (double)m.Elements[3], (double)m.OffsetX, (double)m.OffsetY);
                        path.RenderTransform = new MatrixTransform(matrix);
                        pnlMap.Children.Add(path);
                    }
                    if (obj.GetName() == "rect")
                    {
                        double         x     = PaintObject.StringToDoubleConvertor(obj.GetAttributeValue("x"));
                        double         y     = PaintObject.StringToDoubleConvertor(obj.GetAttributeValue("y"));
                        double         w     = PaintObject.StringToDoubleConvertor(obj.GetAttributeValue("width"));
                        double         h     = PaintObject.StringToDoubleConvertor(obj.GetAttributeValue("height"));
                        SVSObjectStyle style = obj.GetStyle();

                        Rectangle rect = new Rectangle();
                        rect.SetValue(Canvas.LeftProperty, x);
                        rect.SetValue(Canvas.TopProperty, y);
                        rect.Width           = w;
                        rect.Height          = h;
                        rect.Fill            = new System.Windows.Media.SolidColorBrush(Color.FromArgb(style.FillColor.A, style.FillColor.R, style.FillColor.G, style.FillColor.B));
                        rect.Stroke          = new System.Windows.Media.SolidColorBrush(Color.FromArgb(style.BorderColor.A, style.BorderColor.R, style.BorderColor.G, style.BorderColor.B));
                        rect.StrokeThickness = (double)style.BorderSize;
                        System.Drawing.Drawing2D.Matrix m = obj.GetTransformMatrix();
                        Matrix matrix = new Matrix((double)m.Elements[0], (double)m.Elements[1], (double)m.Elements[2], (double)m.Elements[3], (double)m.OffsetX, (double)m.OffsetY);
                        rect.RenderTransform = new MatrixTransform(matrix);
                        pnlMap.Children.Add(rect);
                    }
                }
            }
        }
    void OnGUI()
    {
        string[] menuOptions = new string[2];
        menuOptions[0] = "Prefab Painter";
        menuOptions[1] = "Settings";

        EditorGUILayout.Space();
        toolBar   = GUILayout.Toolbar(toolBar, menuOptions);
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false);

        switch (toolBar)
        {
        case 0:
            float tempSize        = brushSize;
            int   tempDensity     = brushDensity;
            Color originalUIColor = GUI.color;

            // Prefabs
            EditorGUILayout.LabelField("1. Add one or more prefab objects to paint with");
            EditorGUILayout.LabelField("Note: Game Objects will not work");
            listSize = Mathf.Max(0, listSize);

            for (int i = 0; i < objects.Count; i++)
            {
                PaintObject.Display(objects[i]);
            }

            GUI.color = Color.green;
            if (GUILayout.Button("Add Prefab"))
            {
                listSize++;
            }
            GUI.color = Color.red;
            if (GUILayout.Button("Remove Prefab") && listSize != 0)
            {
                listSize--;
            }

            CheckForChanges(tempSize, tempDensity);
            GUI.color = originalUIColor;


            // Brush Settings
            EditorGUILayout.LabelField("2. Configure your Brush Settings");
            BrushSettingsFold = BeginFold("Brush Settings", BrushSettingsFold);
            if (BrushSettingsFold)
            {
                paintMask      = EditorGUILayout.MaskField(new GUIContent("Paint Layer", "On which layer the tool will paint."), paintMask, layerNames.ToArray());
                brushSize      = EditorGUILayout.FloatField("Brush Size", brushSize);
                brushDensity   = EditorGUILayout.IntField("Brush Density", brushDensity);
                paintGroupName = EditorGUILayout.TextField("Paint Group Name", paintGroupName);
            }
            EndFold();

            EditorGUILayout.LabelField("3. Use any of these commands in the Scene View");
            EditorGUILayout.LabelField("ctrl + left mouse button to paint");
            EditorGUILayout.LabelField("ctrl + scroll to change the brush size");
            EditorGUILayout.LabelField("alt + scroll to change the brush density");

            break;

        case 1:
            GizmoFold = BeginFold("Placement Tool", GizmoFold);
            if (GizmoFold)
            {
                showGizmoInfo     = EditorGUILayout.Toggle("Display Brush Info", showGizmoInfo);
                activeColor       = EditorGUILayout.ColorField("Active Color", activeColor);
                passiveColor      = EditorGUILayout.ColorField("Passive Color", passiveColor);
                gizmoNormalLength = EditorGUILayout.FloatField("Arrow Length", gizmoNormalLength);
                SizeInterval      = EditorGUILayout.FloatField("Size Interval", SizeInterval);
                maxYPosition      = EditorGUILayout.FloatField("Maximum Y Position", maxYPosition);
            }
            EndFold();
            break;

        default: break;
        }
        EditorGUILayout.EndScrollView();
    }
    public static void Display(PaintObject obj)
    {
        if (obj == null)
        {
            return;
        }

        Texture2D background = new Texture2D(128, 128);

        for (int y = 0; y < 128; y++)
        {
            for (int x = 0; x < 128; x++)
            {
                background.SetPixel(x, y, Color.grey);
            }
        }
        background.Apply();

        EditorGUILayout.BeginVertical(PrefabPainter.BoxStyle);
        GUILayout.Space(3);

        EditorGUI.BeginChangeCheck();
        GameObject gameObject = obj.prefab;

        if (EditorGUI.EndChangeCheck())
        {
            if (obj.gameObjectEditor != null)
            {
                Object.DestroyImmediate(obj.gameObjectEditor);
            }
        }

        GUIStyle bgColor = new GUIStyle();

        bgColor.normal.background = background;

        if (gameObject != null)
        {
            if (obj.gameObjectEditor == null)
            {
                obj.gameObjectEditor = Editor.CreateEditor(gameObject);
            }
            obj.gameObjectEditor.OnInteractivePreviewGUI(GUILayoutUtility.GetRect(50, 50), bgColor);
        }

        EditorGUI.BeginChangeCheck();
        gameObject = (GameObject)EditorGUILayout.ObjectField("", obj.prefab, typeof(GameObject), true);
        obj.prefab = gameObject;
        if (EditorGUI.EndChangeCheck())
        {
            if (obj.gameObjectEditor != null)
            {
                Object.DestroyImmediate(obj.gameObjectEditor);
            }
        }

        if (obj.prefab != null)
        {
            obj.scale.x = EditorGUILayout.FloatField("Min Size", obj.scale.x);
            obj.scale.y = EditorGUILayout.FloatField("Max Size", obj.scale.y);
            GUILayout.Label("Random Rotation :");
            EditorGUILayout.BeginHorizontal();
            obj.randomRotationX = GUILayout.Toggle(obj.randomRotationX, "X");
            obj.randomRotationY = GUILayout.Toggle(obj.randomRotationY, "Y");
            obj.randomRotationZ = GUILayout.Toggle(obj.randomRotationZ, "Z");
            EditorGUILayout.EndHorizontal();
        }
        GUILayout.Space(3);
        EditorGUILayout.EndVertical();
        GUILayout.Space(0);
    }
Exemplo n.º 12
0
    void OnGUI()
    {
        string[] menuOptions = new string[2];
        menuOptions[0] = "Prefab Painter";
        menuOptions[1] = "Settings";

        EditorGUILayout.Space();
        toolBar   = GUILayout.Toolbar(toolBar, menuOptions);
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false);

        switch (toolBar)
        {
        case 0:
            float tempSize    = brushSize;
            int   tempDensity = brushDensity;

            // Brush Settings
            BrushSettingsFold = BeginFold("Brush Settings", BrushSettingsFold);
            if (BrushSettingsFold)
            {
                paintMask      = EditorGUILayout.MaskField(new GUIContent("Paint Layer", "On which layer the tool will paint."), paintMask, layerNames.ToArray());
                brushSize      = EditorGUILayout.FloatField("Brush Size", brushSize);
                brushDensity   = EditorGUILayout.IntField("Brush Density", brushDensity);
                paintGroupName = EditorGUILayout.TextField("Paint Group Name", paintGroupName);
            }
            EndFold();

            // Prefabs
            listSize = Mathf.Max(0, listSize);

            for (int i = 0; i < objects.Count; i++)
            {
                PaintObject.Display(objects[i]);
            }

            GUI.color = Color.green;
            if (GUILayout.Button("Add Prefab"))
            {
                listSize++;
            }
            GUI.color = Color.red;
            if (GUILayout.Button("Remove Prefab") && listSize != 0)
            {
                listSize--;
            }

            CheckForChanges(tempSize, tempDensity);

            break;

        case 1:
            GizmoFold = BeginFold("Placement Tool", GizmoFold);
            if (GizmoFold)
            {
                showGizmoInfo     = EditorGUILayout.Toggle("Display Brush Info", showGizmoInfo);
                activeColor       = EditorGUILayout.ColorField("Active Color", activeColor);
                passiveColor      = EditorGUILayout.ColorField("Passive Color", passiveColor);
                gizmoNormalLength = EditorGUILayout.FloatField("Arrow Length", gizmoNormalLength);
                SizeInterval      = EditorGUILayout.FloatField("Size Interval", SizeInterval);
                maxYPosition      = EditorGUILayout.FloatField("Maximum Y Position", maxYPosition);
            }
            EndFold();
            break;

        default: break;
        }
        EditorGUILayout.EndScrollView();
    }
Exemplo n.º 13
0
 /// <summary>
 /// FUNCTION    : drawSquare_Click
 /// DESCRIPTION : Set shape to draw to rectangle
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void drawSquare_Click(object sender, RoutedEventArgs e)
 {
     _currentDraw = PaintObject.Rectangle;
 }
Exemplo n.º 14
0
 /// <summary>
 /// FUNCTION    : drawElipse_Click
 /// DESCRIPTION : Set shape to draw to elipse
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void drawElipse_Click(object sender, RoutedEventArgs e)
 {
     _currentDraw = PaintObject.Elipse;
 }
Exemplo n.º 15
0
 /// <summary>
 /// FUNCTION    : drawLine_Click
 /// DESCRIPTION : Set shape to draw to line
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void drawLine_Click(object sender, RoutedEventArgs e)
 {
     _currentDraw = PaintObject.Line;
 }