public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Count() == 3)
            {
                if ((values[0] is double) && (values[1] is double) && (values[2] is LfDragablePointViewModel))
                {
                    LfDragablePointViewModel origVertex = (LfDragablePointViewModel)values[2];

                    Point  currP = TextureBorderHelperClass.GetOriginalPoint(origVertex);
                    Point  prevP = TextureBorderHelperClass.GetPreviousPoint(origVertex);
                    double angle = TextureBorderHelperClass.GetAngle(origVertex, currP, prevP);
                    BorderTextureViewModel border = TextureBorderHelperClass.GetTextureViewModel(origVertex, angle);

                    string texture = border.Texture;

                    if ((texture == "") || (texture == "notDefined"))
                    {
                        return(null);
                    }

                    string s            = GlobalConstants.ImageDirectory + texture + ".png";
                    string fullPath     = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                    string fullFileName = System.IO.Path.Combine(fullPath, s);

                    return(new BitmapImage(new Uri(fullFileName)));
                }
            }

            return(null);
        }
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Count() == 3)
            {
                if ((values[0] is double) && (values[1] is double) && (values[2] is LfDragablePointViewModel))
                {
                    LfDragablePointViewModel origVertex = (LfDragablePointViewModel)values[2];

                    Point  currP = TextureBorderHelperClass.GetOriginalPoint(origVertex);
                    Point  prevP = TextureBorderHelperClass.GetPreviousPoint(origVertex);
                    double angle = TextureBorderHelperClass.GetAngle(origVertex, currP, prevP);
                    BorderTextureViewModel border = TextureBorderHelperClass.GetTextureViewModel(origVertex, angle);
                    Vector offset = TextureBorderHelperClass.GetOffset(origVertex, currP, prevP, angle);

                    if (parameter as string == "x")
                    {
                        return(offset.X);
                    }
                    else
                    {
                        return(offset.Y);
                    }
                }
            }

            return(null);
        }
        public static Vector GetOffset(LfDragablePointViewModel myPoint, Point origP, Point prevP, double angle)
        {
            Vector diffV                  = origP - prevP;
            double distance               = diffV.Length;
            Vector rotatedNormal          = new Vector(-Math.Sin(angle * Math.PI / 180), Math.Cos(angle * Math.PI / 180));
            BorderTextureViewModel border = TextureBorderHelperClass.GetTextureViewModel(myPoint, angle);
            Vector offset                 = -rotatedNormal * border.HorisontalOffset;

            return(offset);
        }
        public LfStaticPolygonViewModel(
            TreeViewViewModel treeParent,
            CompoundObjectViewModel parentVm,
            MainViewModel mainVm,
            LfStaticPolygon modelObject,
            bool enabled = true) :
            base(treeParent, parentVm, mainVm, enabled)
        {
            ModelObject = modelObject;

            GroundBorder    = new BorderTextureViewModel(this, modelObject.PolygonBorder.GroundBorder);
            CeilingBorder   = new BorderTextureViewModel(this, modelObject.PolygonBorder.CeilingBorder);
            LeftWallBorder  = new BorderTextureViewModel(this, modelObject.PolygonBorder.LeftWallBorder);
            RightWallBorder = new BorderTextureViewModel(this, modelObject.PolygonBorder.RightWallBorder);
        }
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Count() == 3)
            {
                if ((values[0] is double) && (values[1] is double) && (values[2] is LfDragablePointViewModel))
                {
                    LfDragablePointViewModel origVertex = (LfDragablePointViewModel)values[2];

                    Point  currP = TextureBorderHelperClass.GetOriginalPoint(origVertex);
                    Point  prevP = TextureBorderHelperClass.GetPreviousPoint(origVertex);
                    double angle = TextureBorderHelperClass.GetAngle(origVertex, currP, prevP);
                    BorderTextureViewModel border = TextureBorderHelperClass.GetTextureViewModel(origVertex, angle);

                    Rect r = new Rect(0, 0, border.TextureWidth, border.TextureHeight);

                    return(r);
                }
            }

            return(null);
        }
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Count() == 3)
            {
                if ((values[0] is double) && (values[1] is double) && (values[2] is LfDragablePointViewModel))
                {
                    LfDragablePointViewModel origVertex = (LfDragablePointViewModel)values[2];

                    Point  currP = TextureBorderHelperClass.GetOriginalPoint(origVertex);
                    Point  prevP = TextureBorderHelperClass.GetPreviousPoint(origVertex);
                    double angle = TextureBorderHelperClass.GetAngle(origVertex, currP, prevP);
                    BorderTextureViewModel border = TextureBorderHelperClass.GetTextureViewModel(origVertex, angle);

                    if ((border.Texture == "") || (border.Texture == "notDefined"))
                    {
                        return(Visibility.Collapsed);
                    }

                    return(Visibility.Visible);
                }
            }

            return(null);
        }