Пример #1
0
        private void DrawObjectGroup(DrawingContext dc, DrawObjectType type)
        {
            double highest = 0;
            double lowest  = double.MaxValue;

            foreach (var i in DrawingObjects.All())
            {
                var obj = i.Value;
                if (obj.Type != type)
                {
                    continue;
                }
                double h = 0;
                double l = 0;
                //candle line.
                if (obj.Type == DrawObjectType.CandleLine)
                {
                    h = MathUtil.GetHighest(obj.Vals2, drawItemStartIndex, drawItemStartIndex + drawItemCount);
                    if (h > highest)
                    {
                        highest = h;
                    }
                    l = MathUtil.GetLowest(obj.Vals3, drawItemStartIndex, drawItemStartIndex + drawItemCount);
                    if (l < lowest)
                    {
                        lowest = l;
                    }
                    continue;
                }

                h = MathUtil.GetHighest(obj.Vals, drawItemStartIndex, drawItemStartIndex + drawItemCount);
                if (h > highest)
                {
                    highest = h;
                }
                l = MathUtil.GetLowest(obj.Vals, drawItemStartIndex, drawItemStartIndex + drawItemCount);
                if (l < lowest)
                {
                    lowest = l;
                }

                //special for zero bars.
                if (obj.Type == DrawObjectType.zVLines)
                {
                    if (highest < -lowest)
                    {
                        highest = -lowest;
                    }
                }
            }

            foreach (var i in DrawingObjects.All())
            {
                var obj = i.Value;
                if (obj.Type == type)
                {
                    DrawObj(dc, highest, lowest, obj);
                }
            }
        }
Пример #2
0
 public DrawObject()
 {
     this._Active      = true;
     this._Name        = this._ID = Guid.NewGuid().ToString();
     this._Type        = DrawObjectType.Undefined;
     this._Translation = new Vertex();
     this._Scale       = new Vertex(1, 1, 1);
     this._Rotation    = new Vertex();
 }
Пример #3
0
 public DrawObject(DrawObject Object)
 {
     this._Active      = Object.Active;
     this._ID          = Guid.NewGuid().ToString();
     this._Name        = Object.Name;
     this._Type        = Object.Type;
     this._Translation = new Vertex(Object.Translation.X, Object.Translation.Y, Object.Translation.Z);
     this._Rotation    = new Vertex(Object.Rotation.X, Object.Rotation.Y, Object.Rotation.Z);
     this._Scale       = new Vertex(Object.Scale.X, Object.Scale.Y, Object.Scale.Z);
 }
Пример #4
0
        private bool b_FoldModality;                                //折线转变的样式。。-|_   false   |-|  true

        public Line(DrawObjectType drawObjectType, int index)
        {
            //
            // TODO: 在此处添加构造函数逻辑
            //
            this.iLineListIndex = index;
            this.iLineNode      = new int[10];
            lineColor           = Color.Black;
            this.drawObjectType = drawObjectType;
            lineTextFont        = new Font("宋体", iTextSize);
        }
Пример #5
0
        private ArrayList arr_OutFlowNodeID;      //流出节点的ID

        /// <param name="index">索引</param>
        /// <param name="drawObjectType">节点类型</param>
        /// <param name="nodeText">节点文本</param>
        public Node(int index, DrawObjectType drawObjectType, string nodeText)
        {
            this.iNodeListIndex    = index;
            this.drawObjectType    = drawObjectType;
            this.nodeText          = nodeText;
            nodeTextFont           = new Font("宋体", iTextSize);
            nodeTextColor          = Color.Black;
            cBorderColor           = Color.Black;
            cFillColor             = Color.Transparent;
            this.dt_inFlowTime     = DateTime.Now;
            this.dt_outFlowTime    = DateTime.Now;
            this.arr_InFlowNodeID  = new ArrayList();
            this.arr_OutFlowNodeID = new ArrayList();
        }
Пример #6
0
        private int x, y; //�ڵ�����

        #endregion Fields

        #region Constructors

        /// <param name="index">����</param>
        /// <param name="drawObjectType">�ڵ�����</param>
        /// <param name="nodeText">�ڵ��ı�</param>
        public Node(int index,DrawObjectType drawObjectType,string nodeText)
        {
            this.iNodeListIndex=index;
            this.drawObjectType=drawObjectType;
            this.nodeText=nodeText;
            nodeTextFont=new Font("����",iTextSize);
            nodeTextColor=Color.Black;
            cBorderColor=Color.Black;
            cFillColor=Color.Transparent;
            this.dt_inFlowTime=DateTime.Now;
            this.dt_outFlowTime=DateTime.Now;
            this.arr_InFlowNodeID=new ArrayList();
            this.arr_OutFlowNodeID=new ArrayList();
        }
Пример #7
0
        /// <summary>
        /// 그리기 도구에 선택된 DrawObject 의 종류에 따라 새로운 DrawObject 객체를 생성해서 반환한다.
        /// </summary>
        /// <param name="aType">그리기 도구에서 선택된 도구의 종류</param>
        /// <param name="aLocation">DrawObject가 그려질 위치</param>
        /// <returns></returns>
        private DrawObject AddNewDrawObject(DrawObjectType aType, Point aLocation)
        {
            switch (aType)
            {
            case DrawObjectType.Rectangle: return(new RectangleObject(aLocation.X, aLocation.Y, 1, 1));

            case DrawObjectType.Ellipse: return(new EllipseObject(aLocation.X, aLocation.Y, 1, 1));

            case DrawObjectType.Line: return(new LineObject(aLocation.X, aLocation.Y, aLocation.X + 1, aLocation.Y + 1));

            case DrawObjectType.Pencil:
                this.mLastX = aLocation.X;
                this.mLastY = aLocation.Y;
                return(this.mNewPencil = new PencilObejct(aLocation.X, aLocation.Y, aLocation.X + 1, aLocation.Y + 1));
            }

            return(new RectangleObject(aLocation.X, aLocation.Y, 1, 1));
        }
Пример #8
0
 // 초기화
 private void Init(string key, DrawObjectType type)
 {
     ObjectType = type;
     Key        = key;
     Id         = 0;
     X          = 0;
     Y          = 0;
     Width      = 100;
     Height     = 100;
     LineColor  = Color.Black;
     LineWidth  = 1;
     FillColor  = Color.Empty;
     Text       = string.Empty;
     TextAlign  = DrawHelper.GetStringAlign(1);
     FontStyle  = new Font("굴림체", 10);
     FontColor  = Color.Black;
     Angle1     = 0;
     Angle2     = 180;
     Img        = null;
 }
Пример #9
0
 //Events
 private void SceneTree_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (_BlockEvents)
     {
         return;
     }
     if (SceneTree.SelectedNode != null)
     {
         if (SceneTree.Nodes[0] == SceneTree.SelectedNode)
         {
             _Interface.CurrentSceneObject = null;
             _Interface.CurrentSelection   = _Interface.CurrentScene;
         }
         if (SceneTree.SelectedNode.Tag != null)
         {
             for (int i = 0; i < _Interface.CurrentScene.Objects.Count; i++)
             {
                 if (_Interface.CurrentScene.Objects[i].ID == ((object[])SceneTree.SelectedNode.Tag)[2].ToString())
                 {
                     _Interface.CurrentSceneObject = _Interface.CurrentScene.Objects[i];
                     _Interface.CurrentSelection   = _Interface.CurrentScene.Objects[i];
                 }
             }
             DrawObjectType Type = (DrawObjectType)((object[])SceneTree.SelectedNode.Tag)[0];
             deleteToolStripMenuItem.Visible       = true;
             SetAsCurrentToolStripMenuItem.Visible = Type == DrawObjectType.Camera;
         }
         else
         {
             SetAsCurrentToolStripMenuItem.Visible = false;
             deleteToolStripMenuItem.Visible       = false;
         }
     }
     else
     {
         SetAsCurrentToolStripMenuItem.Visible = false;
         deleteToolStripMenuItem.Visible       = false;
     }
 }
Пример #10
0
        public DrawObject(DrawObjectType type,
                          VsqFileEx vsq,
                          Rectangle rect,
                          string text_,
                          int accent_,
                          int decay,
                          int velocity,
                          int internal_id,
                          int vibrato_delay,
                          bool overwrapped,
                          bool symbol_protected,
                          VibratoBPList vib_rate,
                          VibratoBPList vib_depth,
                          int vib_start_rate,
                          int vib_start_depth,
                          int note_,
                          UstEnvelope ust_envelope,
                          int length,
                          int clock,
                          bool is_valid_for_utau,
                          bool is_valid_for_straight,
                          int vib_delay,
                          int intensity)
        {
            this.mType           = type;
            mRectangleInPixel    = rect;
            mText                = text_;
            mAccent              = accent_;
            mDecay               = decay;
            mVelocity            = velocity;
            mInternalID          = internal_id;
            mVibratoDelayInPixel = vibrato_delay;
            mIsOverlapped        = overwrapped;
            mIsSymbolProtected   = symbol_protected;
            mIntensity           = intensity;

            mNote                    = note_;
            mUstEnvelope             = ust_envelope;
            this.mLength             = length;
            this.mClock              = clock;
            this.mIsValidForUtau     = is_valid_for_utau;
            this.mIsValidForStraight = is_valid_for_straight;
            this.mVibDelay           = vib_delay;

            int viblength = length - vib_delay;

            if (viblength > 0 && vib_rate != null && vib_depth != null)
            {
                VibratoPointIteratorByClock itr =
                    new VibratoPointIteratorByClock(vsq.TempoTable,
                                                    vib_rate, vib_start_rate,
                                                    vib_depth, vib_start_depth,
                                                    clock + vib_delay, viblength);
                mVibratoPit = new float[viblength];
                for (int i = 0; i < viblength; i++)
                {
                    if (!itr.hasNext())
                    {
                        break;
                    }
                    double v = itr.next();
                    mVibratoPit[i] = (float)v;
                }
            }
        }
Пример #11
0
 /// <summary>
 /// DrawObject 생성자
 /// </summary>
 /// <param name="type">오브젝트 타입</param>
 public DrawObject(DrawObjectType type)
 {
     Init("Object", type);
 }
Пример #12
0
 /// <summary>
 /// DrawObject 생성자
 /// </summary>
 /// <param name="key">오브젝트 키</param>
 /// <param name="type">오브젝트 타입</param>
 public DrawObject(string key, DrawObjectType type)
 {
     Init(key, type);
 }
Пример #13
0
        void DrawObject(object drawObject, DrawObjectType drawObjectType,int id)
        {
            if (drawObjectType == DrawObjectType.ship)
            {
                GL.Enable(EnableCap.Texture2D);
                 for (int i = 0; i < drawNum; i++)
                     if (((lwGeomObjInfo)this.drawObject[i]).anim_data != null && ((lwGeomObjInfo)this.drawObject[i]).anim_data.anim_mat != null)
                     {
                         DrawGeom((lwGeomObjInfo)drawObject, ((lwGeomObjInfo)this.drawObject[i]).anim_data.anim_mat, true);
                         break;
                     }
                 GL.Disable(EnableCap.Texture2D);
            }
            if (drawObjectType == DrawObjectType.item)
            {
                lwGeomObjInfo geom = (lwGeomObjInfo)drawObject;
                GL.Enable(EnableCap.Texture2D);
                Random rand = new Random((int)(id * geom.mesh.header.index_num));
                rand.Next(); rand.Next(); rand.Next(); rand.Next();
                GL.PushMatrix();
                if (id == 1) GL.Translate(-1, -1, 0);
                if (id == 2) GL.Translate(1, -1, 0);
                if (id == 3) GL.Translate(1, 1, 0);
                if (id == 4) GL.Translate(-1, 1, 0);
                GL.Rotate(rand.Next(100), 0, 0, 1);
                DrawGeom(geom);
                GL.PopMatrix();
                GL.Disable(EnableCap.Texture2D);
            }
            if (drawObjectType == DrawObjectType.lgo)
            {
                if (drawNum > 1)
                {
                    lwAnimDataBone bone = null;
                    for (int i = 0; i < drawNum; i++)
                        if (this.drawObjectType[i] == DrawObjectType.lab)
                        {
                            bone = (lwAnimDataBone)this.drawObject[i];
                            break;
                        }
                    if (bone != null)
                    {
                        lwGeomObjInfo geom = (lwGeomObjInfo)drawObject;

                        GL.Enable(EnableCap.Texture2D);
                        DrawGeom(geom, bone);
                        GL.Disable(EnableCap.Texture2D);
                        return;
                    }
                }
                lwGeomObjInfo geom2 = (lwGeomObjInfo)drawObject;

                GL.Enable(EnableCap.Texture2D);
                DrawGeom(geom2);
                GL.Disable(EnableCap.Texture2D);
            }
            if (drawObjectType == DrawObjectType.lmo)
            {
                lwModelObjInfo model = (lwModelObjInfo)drawObject;

                GL.Enable(EnableCap.Texture2D);
                for (int i = 0; i < model.geom_obj_num; i++)
                {
                    lwGeomObjInfo geom = model.geom_obj_seq[i];
                    DrawGeom(geom);
                }
                GL.Disable(EnableCap.Texture2D);
            }
            else if (drawObjectType == DrawObjectType.lab)
            {
                if (drawNum > 1)
                    return;

                lwAnimDataBone bone = (lwAnimDataBone)drawObject;
                DrawBone(bone);
            }
        }