Exemplo n.º 1
0
 public BlimpCameraMan(ILocatable posLoc, ILocatable lookAt)
 {
     Dirty = true;
     Pos3d = posLoc.ToPositionAboveSeaLeveld (_altitude);
     LookAt = new Location (lookAt);
     LookAt3d = LookAt.ToPositionAboveSeaLeveld (0);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LongPressAction"/> class.
 /// </summary>
 /// <param name="touchScreen">The <see cref="ITouchScreen"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public LongPressAction(ITouchScreen touchScreen, ILocatable actionTarget)
     : base(touchScreen, actionTarget)
 {
     if (actionTarget == null)
     {
         throw new ArgumentException("Must provide a location for a single tap action.", "actionTarget");
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveMouseAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public MoveMouseAction(IMouse mouse, ILocatable actionTarget)
     : base(mouse, actionTarget)
 {
     if (actionTarget == null)
     {
         throw new ArgumentException("Must provide a location for a move action.", "actionTarget");
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SingleKeyAction"/> class.
        /// </summary>
        /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
        /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
        /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
        /// <param name="key">The modifier key (<see cref="Keys.Shift"/>, <see cref="Keys.Control"/>, <see cref="Keys.Alt"/>) to use in the action.</param>
        protected SingleKeyAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string key)
            : base(keyboard, mouse, actionTarget)
        {
            if (!ModifierKeys.Contains(key))
            {
                throw new ArgumentException("key must be a modifier key (Keys.Shift, Keys.Control, or Keys.Alt)", "key");
            }

            this.key = key;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds the specified <see cref="ILocatable"/> to the <see cref="GridBucket"/> that covers
        /// its current location
        /// </summary>
        /// <param name="item"></param>
        public void AddItem(ILocatable item)
        {
            int x = (int)(item.XPos / _xBlockWidth);
            int y = (int)(item.YPos / _yBlockHeight);

            // Ensure we clamp the ceiling value
            if (x == _numXBlocks) { x--; }
            if (y == _numYBlocks) { y--; }

            _buckets[x, y].Add(item);       
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScrollAction"/> class for use with the specified element.
        /// </summary>
        /// <param name="touchScreen">The <see cref="ITouchScreen"/> with which the action will be performed.</param>
        /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
        /// <param name="offsetX">The x coordinate relative to the view port.</param>
        /// <param name="offsetY">The y coordinate relative to the view port.</param>
        public ScrollAction(ITouchScreen touchScreen, ILocatable actionTarget, int offsetX, int offsetY)
            : base(touchScreen, actionTarget)
        {
            if (actionTarget == null)
            {
                throw new ArgumentException("Must provide a location for a single tap action.", "actionTarget");
            }

            this.offsetX = offsetX;
            this.offsetY = offsetY;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Returns the distance between this ant and the <see cref="ILocatable"/> item
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        private float GetDistance(ILocatable target)
        {
            // Use pythagora
            float xOffset = (float)XPos - (float)target.XPos;
            float yOffset = (float)YPos - (float)target.YPos;

            float xOffsetSquared = xOffset * xOffset;
            float yOffsetSquared = yOffset * yOffset;

            float distance = (float)Math.Sqrt(xOffset + yOffset);

            return distance;
        }
Exemplo n.º 8
0
        public static Vector3 ToPositionAboveSeaLevelSimple(this ILocatable loc, float kmAboveSea)
        {
            var p = loc.ToMercator();

            return(new Vector3(p.X, p.Y, kmAboveSea * 0.000156785581f));
        }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyUpAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 /// <param name="key">The modifier key (<see cref="Keys.Shift"/>, <see cref="Keys.Control"/>, <see cref="Keys.Alt"/>) to use in the action.</param>
 public KeyUpAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string key)
     : base(keyboard, mouse, actionTarget, key)
 {
 }
Exemplo n.º 10
0
 public static string ToLocationString(this ILocatable loc)
 {
     return(ToLocationString(loc, "(latitude {0}, longitude {1})"));
 }
Exemplo n.º 11
0
 public static Vector2 VectorTo(this ILocatable fr, ILocatable to)
 {
     return(new Vector2((float)(to.Longitude - fr.Longitude),
                        (float)(to.Latitude - fr.Latitude)));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveToOffsetAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 /// <param name="offsetX">The horizontal offset from the origin of the target to which to move the mouse.</param>
 /// <param name="offsetY">The vertical offset from the origin of the target to which to move the mouse.</param>
 public MoveToOffsetAction(IMouse mouse, ILocatable actionTarget, int offsetX, int offsetY)
     : base(mouse, actionTarget)
 {
     this.offsetX = offsetX;
     this.offsetY = offsetY;
 }
Exemplo n.º 13
0
        public void Rotate(ILocatable loc, float ddegs)
        {
            _pos = _pos.RotateAround(loc, ddegs);
            LookAt = LookAt.RotateAround(loc, ddegs);

            Pos3d = _pos.ToPositionAboveSeaLeveld (_altitude);
            LookAt3d = LookAt.ToPositionAboveSeaLeveld (0);

            Dirty = true;
        }
Exemplo n.º 14
0
 protected ObstacleController(ILocatable locatable, Obstacle obstacle) :
     base(obstacle)
 {
     Obstacle = obstacle;
 }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SendKeysAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 /// <param name="keysToSend">The key sequence to send.</param>
 public SendKeysAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string keysToSend)
     : base(keyboard, mouse, actionTarget)
 {
     this.keysToSend = keysToSend;
 }
Exemplo n.º 16
0
 public void SetLookAt(ILocatable lookAt, bool animated)
 {
 }
Exemplo n.º 17
0
 protected TouchAction(ITouchScreen touchScreen, ILocatable actionTarget) : base(actionTarget)
 {
     this.touchScreen = touchScreen;
 }
Exemplo n.º 18
0
 public Location(ILocatable loc)
 {
     Longitude = loc.Longitude;
     Latitude = loc.Latitude;
 }
Exemplo n.º 19
0
 public void SetLookAt(ILocatable lookAt, bool animated)
 {
 }
Exemplo n.º 20
0
        public void Scale(ILocatable loc, float scale)
        {
            var toCam = (Pos3d - LookAt3d);
            var dist = toCam.Length;

            var sdist = dist / scale;
            toCam.Normalize();
            var newPos = LookAt3d + toCam * sdist;

            var alt = newPos.Length - Location.EarthRadiusInKm;

            _altitude = (float)alt;
            if (_altitude > 12500.0f) _altitude = 12500.0f;
            if (_altitude < 0.03f) _altitude = 0.03f;

            Pos3d = _pos.ToPositionAboveSeaLeveld(_altitude);

            Dirty = true;
        }
Exemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MouseAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="target">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public MouseAction(IMouse mouse, ILocatable target)
     : base(target)
 {
     this.mouse = mouse;
 }
Exemplo n.º 22
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="WebDriverAction" /> class for the given element.
 /// </summary>
 /// <param name="actionLocation">An <see cref="ILocatable" /> object that provides coordinates for this action.</param>
 protected WebDriverAction(ILocatable actionLocation)
 {
     ActionTarget = actionLocation;
 }
Exemplo n.º 23
0
 public WallObstacleController(ILocatable locatable, Obstacle obstacle) : base(locatable, obstacle)
 {
     Object.Collider = new WallCollider(obstacle.Collider.Radius, locatable);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyDownAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 /// <param name="key">The modifier key (<see cref="Keys.Shift"/>, <see cref="Keys.Control"/>, <see cref="Keys.Alt"/>) to use in the action.</param>
 public KeyDownAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string key)
     : base(keyboard, mouse, actionTarget, key)
 {
 }
Exemplo n.º 25
0
 public RunnerObstacleController(ILocatable locatable, Obstacle obstacle) : base(locatable, obstacle)
 {
 }
Exemplo n.º 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SendKeysAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 /// <param name="keysToSend">The key sequence to send.</param>
 public SendKeysAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string keysToSend)
     : base(keyboard, mouse, actionTarget)
 {
     this.keysToSend = keysToSend;
 }
 public InsertMissingTokensDecorator(TokenWriter writer, ILocatable locationProvider)
     : base(writer)
 {
     this.locationProvider = locationProvider;
     currentList           = new List <AstNode>();
 }
Exemplo n.º 28
0
 public ManualCameraMan(ILocatable posLoc, ILocatable lookAt)
 {
     Dirty = true;
     _pos = new Location(posLoc);
     Pos3d = _pos.ToPositionAboveSeaLeveld (_altitude);
     LookAt = new Location (lookAt);
     LookAt3d = LookAt.ToPositionAboveSeaLeveld (0);
 }
Exemplo n.º 29
0
        /// <summary>
        /// Returns a Rect which describes the bounds of the element being dragged.
        /// </summary>
        private Rect CalculateDragElementRect(ILocatable el, double newHorizOffset, double newVertOffset, bool modLeftOffset, bool modTopOffset)
        {
            //if(this.elementsBeingDragged.Count == 0)
            //    throw new InvalidOperationException("ElementBeingDragged is null.");

            //double xMin = 10000000.0;
            //double yMin = 10000000.0;
            //double xMax = -10000000.0;
            //double yMax = -10000000.0;
            //foreach (UIElement el in this.elementsBeingDragged)
            //{
            //    double elX = Canvas.GetLeft(el);
            //    double elY = Canvas.GetTop(el);
            //    xMin = Math.Min(xMin, elX);
            //    yMin = Math.Min(yMin, elY);
            //    xMax = Math.Max(xMax, elX + el.RenderSize.Width);
            //    yMax = Math.Max(yMax, elY + el.RenderSize.Height);
            //}

            //Size elemSize = new Size(xMax - xMin, yMax - yMin);

            //if (this.ElementBeingDragged == null)
            //    throw new InvalidOperationException("ElementBeingDragged is null.");

            //Size elemSize = this.elementsBeingDragged.RenderSize;

            //Size elemSize = el.RenderSize;
            Size elemSize = new Size(el.Width, el.Height);

            double x, y;

            if (modLeftOffset)
                x = newHorizOffset;
            else
                x = this.ActualWidth - newHorizOffset - elemSize.Width;

            if (modTopOffset)
                y = newVertOffset;
            else
                y = this.ActualHeight - newVertOffset - elemSize.Height;

            Point elemLoc = new Point(x, y);

            return new Rect(elemLoc, elemSize);
        }
Exemplo n.º 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyboardAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 protected KeyboardAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget)
     : base(actionTarget)
 {
     this.keyboard = keyboard;
     this.mouse = mouse;
 }
Exemplo n.º 31
0
 public LocLinAnim(double duration, ILocatable start, ILocatable end)
 {
     _start = new Location(start);
     _end = new Location(end);
     _current = _start;
     _duration = duration;
 }
Exemplo n.º 32
0
 /// <summary>
 /// Location event handler for when the main map element changes location.
 /// </summary>
 /// <param name="obj">The main map element as a locatable</param>
 private void Location_OnUpdated(ILocatable obj)
 {
     UpdateFootprintPositions();
 }
Exemplo n.º 33
0
 public Location(ILocatable loc)
 {
     Longitude = loc.Longitude;
     Latitude  = loc.Latitude;
 }
Exemplo n.º 34
0
 public WallCollider(int radius, ILocatable locatable) : base(radius, locatable)
 {
 }
Exemplo n.º 35
0
 public static Location LocationAway(this ILocatable fr, Vector2 d)
 {
     return(new Location(fr.Longitude + d.X, fr.Latitude + d.Y));
 }
Exemplo n.º 36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveToOffsetAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 /// <param name="offsetX">The horizontal offset from the origin of the target to which to move the mouse.</param>
 /// <param name="offsetY">The vertical offset from the origin of the target to which to move the mouse.</param>
 public MoveToOffsetAction(IMouse mouse, ILocatable actionTarget, int offsetX, int offsetY)
     : base(mouse, actionTarget)
 {
     this.offsetX = offsetX;
     this.offsetY = offsetY;
 }
Exemplo n.º 37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebDriverAction"/> class for the given element.
 /// </summary>
 /// <param name="actionLocation">An <see cref="ILocatable"/> object tha provides coordinates for this action.</param>
 protected WebDriverAction(ILocatable actionLocation)
 {
     this.where = actionLocation;
 }
Exemplo n.º 38
0
 public Element(IWebElement element, string name)
 {
     _element   = element;
     _locatable = element as ILocatable;
     Name       = name;
 }
Exemplo n.º 39
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MouseAction" /> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse" /> with which the action will be performed.</param>
 /// <param name="target">An <see cref="ILocatable" /> describing an element at which to perform the action.</param>
 public MouseAction(IMouse mouse, ILocatable target) : base(target)
 {
     Mouse = mouse;
 }
Exemplo n.º 40
0
 public Element(IWebElement element)
 {
     _element   = element;
     _locatable = element as ILocatable;
 }
Exemplo n.º 41
0
 /// <summary>
 /// Construct a DraggedNode for a given ILocatable object.
 /// </summary>
 /// <param name="locatable">The ILocatable (usually a node) that is
 /// associated with this DraggedNode object. During an update, the
 /// position of ILocatable will be updated based on the specified
 /// mouse position and the internal delta values.</param>
 /// <param name="mouseCursor">The mouse cursor at the point this
 /// DraggedNode object is constructed. This is used to determine the
 /// offset of the ILocatable from the mouse cursor.</param>
 /// <param name="region">The region within which the ILocatable can
 /// be moved. However, the movement of ILocatable will be limited by
 /// region and that it cannot be moved beyond the region.</param>
 ///
 public DraggedNode(ILocatable locatable, Point2D mouseCursor)
 {
     this.locatable = locatable;
     deltaX         = mouseCursor.X - locatable.X;
     deltaY         = mouseCursor.Y - locatable.Y;
 }
Exemplo n.º 42
0
        /// <summary>
        /// Gets the url format for the specified data item that implements <see cref="T:Telerik.Sitefinity.GenericContent.Model.ILocatable"/> interface.
        /// </summary>
        /// <param name="item">The locatable item for which the url format should be returned.</param>
        /// <returns>
        /// Regular expression used to format the url.
        /// </returns>
        public override string GetUrlFormat(ILocatable item)
        {
            if (item.GetType() == typeof(ProjectItem))
            {
                return "/[UrlName]";
            }

            return base.GetUrlFormat(item);
        }
Exemplo n.º 43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClickAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public ClickAction(IMouse mouse, ILocatable actionTarget)
     : base(mouse, actionTarget)
 {
 }
Exemplo n.º 44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyboardAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 protected KeyboardAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget)
     : base(actionTarget)
 {
     this.keyboard = keyboard;
     this.mouse    = mouse;
 }
Exemplo n.º 45
0
        public CSharpHighlightingTokenWriter(TokenWriter decoratedWriter, ISmartTextOutput textOutput = null, ILocatable locatable = null)
            : base(decoratedWriter)
        {
            var highlighting = HighlightingManager.Instance.GetDefinition("C#");

            this.locatable  = locatable;
            this.textOutput = textOutput;

            this.visibilityKeywordsColor    = highlighting.GetNamedColor("Visibility");
            this.namespaceKeywordsColor     = highlighting.GetNamedColor("NamespaceKeywords");
            this.structureKeywordsColor     = highlighting.GetNamedColor("Keywords");
            this.gotoKeywordsColor          = highlighting.GetNamedColor("GotoKeywords");
            this.queryKeywordsColor         = highlighting.GetNamedColor("QueryKeywords");
            this.exceptionKeywordsColor     = highlighting.GetNamedColor("ExceptionKeywords");
            this.checkedKeywordColor        = highlighting.GetNamedColor("CheckedKeyword");
            this.unsafeKeywordsColor        = highlighting.GetNamedColor("UnsafeKeywords");
            this.valueTypeKeywordsColor     = highlighting.GetNamedColor("ValueTypeKeywords");
            this.referenceTypeKeywordsColor = highlighting.GetNamedColor("ReferenceTypeKeywords");
            this.operatorKeywordsColor      = highlighting.GetNamedColor("OperatorKeywords");
            this.parameterModifierColor     = highlighting.GetNamedColor("ParameterModifiers");
            this.modifiersColor             = highlighting.GetNamedColor("Modifiers");
            this.accessorKeywordsColor      = highlighting.GetNamedColor("GetSetAddRemove");

            this.referenceTypeColor     = highlighting.GetNamedColor("ReferenceTypes");
            this.valueTypeColor         = highlighting.GetNamedColor("ValueTypes");
            this.interfaceTypeColor     = highlighting.GetNamedColor("InterfaceTypes");
            this.enumerationTypeColor   = highlighting.GetNamedColor("EnumTypes");
            this.typeParameterTypeColor = highlighting.GetNamedColor("TypeParameters");
            this.delegateTypeColor      = highlighting.GetNamedColor("DelegateTypes");
            this.methodDeclarationColor = this.methodCallColor = highlighting.GetNamedColor("MethodCall");
            //this.eventDeclarationColor = this.eventAccessColor = defaultTextColor;
            //this.propertyDeclarationColor = this.propertyAccessColor = defaultTextColor;
            this.fieldDeclarationColor = this.fieldAccessColor = highlighting.GetNamedColor("FieldAccess");
            //this.variableDeclarationColor = this.variableAccessColor = defaultTextColor;
            //this.parameterDeclarationColor = this.parameterAccessColor = defaultTextColor;
            this.valueKeywordColor      = highlighting.GetNamedColor("NullOrValueKeywords");
            this.thisKeywordColor       = highlighting.GetNamedColor("ThisOrBaseReference");
            this.trueKeywordColor       = highlighting.GetNamedColor("TrueFalse");
            this.typeKeywordsColor      = highlighting.GetNamedColor("TypeKeywords");
            this.attributeKeywordsColor = highlighting.GetNamedColor("AttributeKeywords");
            //this.externAliasKeywordColor = ...;
        }
Exemplo n.º 46
0
 public void SnapToObject(ILocatable obj) //toggles on snapping to given object by assigning vars. acutal snapping is done in update method
 {
     snapToObject = true;
     snapObject   = obj;
 }
Exemplo n.º 47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ButtonReleaseAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public ButtonReleaseAction(IMouse mouse, ILocatable actionTarget)
     : base(mouse, actionTarget)
 {
 }
Exemplo n.º 48
0
        /// <summary>
        /// Drag over this widget to another widget
        /// </summary>
        /// <param name="target">The target widget.</param>
        public virtual void DragOver(IWidget target)
        {
            IMouse     mouse = ((IHasInputDevices)Driver.WebDriver).Mouse;
            ILocatable root  = (ILocatable)Driver.FindElement(By.TagName("body"));
            //cast IWebElement to ILocatable
            ILocatable sourceL = (ILocatable)_contentElement;
            ILocatable targetL = (ILocatable)target.ContentElement;

            ICoordinates coord = root.Coordinates;

            mouse.MouseDown(sourceL.Coordinates);

            //get source position (center,center)
            int sourceX = sourceL.Coordinates.LocationInDom.X + _contentElement.Size.Width / 2;
            int sourceY = sourceL.Coordinates.LocationInDom.Y + _contentElement.Size.Height / 2;

            // get target position (center, center)
            int targetX = targetL.Coordinates.LocationInDom.X + target.ContentElement.Size.Width / 2;
            int targetY = targetL.Coordinates.LocationInDom.Y + target.ContentElement.Size.Height / 2;

            //compute deltas between source and target position
            //delta must be positive, however
            //also we have to define the direction
            int directionX = 1; //move direction is right

            int directionY = 1; //move direction is bottom

            var deltaX = targetX - sourceX;

            if (deltaX < 0)
            {
                deltaX    *= -1;
                directionX = -1; // move direction is left
            }

            var deltaY = targetY - sourceY;

            if (deltaY < 0)
            {
                deltaY    *= -1;
                directionY = -1; // move direction is top
            }

            //define base delta, which must be the higher one

            int baseDelta = deltaX;

            if (deltaY > deltaX)
            {
                baseDelta = deltaY;
            }

            // iterate base delta, set mouse cursor in relation to delta x & delta y
            int x = 0;
            int y = 0;

            for (int i = 1; i <= baseDelta; i += 4)
            {
                if (i > baseDelta)
                {
                    i = baseDelta;
                }

                x = sourceX + deltaX * i / baseDelta * directionX;
                y = sourceY + deltaY * i / baseDelta * directionY;

                mouse.MouseMove(coord, x, y);
                //System.out.println(x +", "+ y);
                Thread.Sleep(1);
            }

            // source has the same coordinates as target
            if (sourceX == targetX && sourceY == targetY)
            {
                mouse.MouseMove(targetL.Coordinates, x++, y);
                Thread.Sleep(20);
            }
        }
Exemplo n.º 49
0
 public static Vector2 VectorTo(this ILocatable fr, ILocatable to)
 {
     return new Vector2((float)(to.Longitude - fr.Longitude),
                        (float)(to.Latitude - fr.Latitude));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WebDriverAction"/> class for the given element.
 /// </summary>
 /// <param name="actionLocation">An <see cref="ILocatable"/> object that provides coordinates for this action.</param>
 protected WebDriverAction(ILocatable actionLocation)
 {
     this.where = actionLocation;
 }
Exemplo n.º 51
0
        private static bool IsInRegion(Rect region, ILocatable locatable, bool fullyEnclosed)
        {
            double x0 = locatable.X;
            double y0 = locatable.Y;

            if (false == fullyEnclosed) // Cross selection.
            {
                var test = new Rect(x0, y0, locatable.Width, locatable.Height);
                return region.IntersectsWith(test);
            }

            double x1 = x0 + locatable.Width;
            double y1 = y0 + locatable.Height;
            return (region.Contains(x0, y0) && region.Contains(x1, y1));
        }
Exemplo n.º 52
0
 public ButtonReleaseAction(IMouse mouse, ILocatable actionTarget) : base(mouse, actionTarget)
 {
 }
		public InsertMissingTokensDecorator(TokenWriter writer, ILocatable locationProvider)
			: base(writer)
		{
			this.locationProvider = locationProvider;
			currentList = new List<AstNode>();
		}
Exemplo n.º 54
0
        static double ArcTo(this ILocatable start, ILocatable finish)
        {
            var lon1 = start.Longitude;
            var lat1 = start.Latitude;
            var lon2 = finish.Longitude;
            var lat2 = finish.Latitude;

            var dlon = ToRadians(lon2 - lon1);
            var dlat = ToRadians(lat2 - lat1);

            var clat1 = Math.Cos(ToRadians(lat1));
            var clat2 = Math.Cos(ToRadians(lat2));

            var sdlat2 = Math.Sin(dlat/2);
            var sdlon2 = Math.Sin(dlon/2);

            var a = (sdlat2*sdlat2) + clat1 * clat2 * (sdlon2*sdlon2);
            var c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1-a));

            return c;
        }
Exemplo n.º 55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TouchAction"/> class.
 /// </summary>
 /// <param name="touchScreen">The <see cref="ITouchScreen"/> to use in performing the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 protected TouchAction(ITouchScreen touchScreen, ILocatable actionTarget)
     : base(actionTarget)
 {
     this.touchScreen = touchScreen;
 }
Exemplo n.º 56
0
 public static double KmTo(this ILocatable start, ILocatable finish)
 {
     return(Location.EarthRadiusInKm * ArcTo(start, finish));
 }
Exemplo n.º 57
0
 /// <summary>
 /// Construct a DraggedNode for a given ILocatable object.
 /// </summary>
 /// <param name="locatable">The ILocatable (usually a node) that is 
 /// associated with this DraggedNode object. During an update, the 
 /// position of ILocatable will be updated based on the specified 
 /// mouse position and the internal delta values.</param>
 /// <param name="mouseCursor">The mouse cursor at the point this 
 /// DraggedNode object is constructed. This is used to determine the 
 /// offset of the ILocatable from the mouse cursor.</param>
 /// <param name="region">The region within which the ILocatable can 
 /// be moved. However, the movement of ILocatable will be limited by 
 /// region and that it cannot be moved beyond the region.</param>
 /// 
 public DraggedNode(ILocatable locatable, Point mouseCursor)
 {
     this.locatable = locatable;
     deltaX = mouseCursor.X - locatable.X;
     deltaY = mouseCursor.Y - locatable.Y;
 }
Exemplo n.º 58
0
 public void SetLookAt(ILocatable lookAt, bool animated)
 {
     if (animated) {
         _lookAtAnim = new LocLinAnim(2, LookAt, lookAt);
         var oldLocPos = LookAt.ToPositionAboveSeaLeveld(_altitude);
         _posAnim = new VectorLinAnim(5, Pos3d, oldLocPos);
     }
     else {
         LookAt = new Location(lookAt);
         LookAt3d = LookAt.ToPositionAboveSeaLeveld (0);
         Dirty = true;
     }
 }
Exemplo n.º 59
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClickAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public ClickAction(IMouse mouse, ILocatable actionTarget)
     : base(mouse, actionTarget)
 {
 }
Exemplo n.º 60
0
 public static double FeetTo(this ILocatable start, ILocatable finish)
 {
     return(5280 * MilesTo(start, finish));
 }