public ViewSettingDialog(Graphics.DocumentViews docviews, ViewSetting setting)
        {
            InitializeComponent();

            _docviews = docviews;
            _setting  = setting;

            propertyGrid1.SelectedObject = _setting;
            viewControl.BackColor        = _setting.BackgroundColor;

            viewControl.SceneGraph.WorldScenes.Add(new WorldSphere());

            viewControl.SceneGraph.WorldScenes.Add(
                delegate(Graphics.ISceneContext context)
            {
                using (var scope = context.Push()) {
                    scope.Color = this.ActiveLight.Enabled ? _setting.Color : Color.LightGray;
                    Graphics.Util.DrawSolidSphere(
                        new Geom.Sphere3d(Geom.Point3d.Zero, 1.0));
                }
            }
                );

            viewControl.SceneGraph.CameraScenes.Add(
                delegate(Graphics.ISceneContext context)
            {
                if (!this.ActiveLight.Enabled)
                {
                    return;
                }

                Geom.HmCod3d p  = this.ActiveLight.Position;
                Geom.Vector3d d = new Geom.Vector3d(p.X, p.Y, p.Z).Normalize();

                Geom.CodSys3d sys = new Geom.CodSys3d(d, new Geom.Point3d(d.x, d.y, d.z));
                Geom.Point3d top  = Geom.Point3d.Zero;
                Geom.Point3d end  = new Geom.Point3d(0, 0, 2);
                Geom.Point3d px1  = new Geom.Point3d(0.3, 0, 0.8);
                Geom.Point3d px2  = new Geom.Point3d(-0.3, 0, 0.8);
                Geom.Point3d py1  = new Geom.Point3d(0, 0.3, 0.8);
                Geom.Point3d py2  = new Geom.Point3d(0, -0.3, 0.8);
                top = sys.Globalize(top);
                end = sys.Globalize(end);
                px1 = sys.Globalize(px1);
                px2 = sys.Globalize(px2);
                py1 = sys.Globalize(py1);
                py2 = sys.Globalize(py2);

                using (var scope = context.Push()) {
                    scope.Color = Color.White;
                    context.DrawLineStrip(gl => gl.Vertices(end, top, px1, px2, top, py1, py2, top));
                }
            }
                );

            this.ActiveLightChanged(null, EventArgs.Empty);
            viewControl.Fit();
        }
        public ViewSettingDialog( Graphics.DocumentViews docviews, ViewSetting setting )
        {
            InitializeComponent();

              _docviews = docviews;
              _setting = setting;

              propertyGrid1.SelectedObject = _setting;
              viewControl.BackColor = _setting.BackgroundColor;

              viewControl.SceneGraph.WorldScenes.Add( new WorldSphere() );

              viewControl.SceneGraph.WorldScenes.Add(
              delegate( Graphics.ISceneContext context )
              {
            using ( var scope = context.Push() ) {
              scope.Color = this.ActiveLight.Enabled ? _setting.Color : Color.LightGray;
              Graphics.Util.DrawSolidSphere(
                new Geom.Sphere3d( Geom.Point3d.Zero, 1.0 ) );
            }
              }
            );

              viewControl.SceneGraph.CameraScenes.Add(
              delegate( Graphics.ISceneContext context )
              {
            if ( !this.ActiveLight.Enabled ) return;

            Geom.HmCod3d p = this.ActiveLight.Position;
            Geom.Vector3d d = new Geom.Vector3d( p.X, p.Y, p.Z ).Normalize();

            Geom.CodSys3d sys = new Geom.CodSys3d( d, new Geom.Point3d( d.x, d.y, d.z ) );
            Geom.Point3d top = Geom.Point3d.Zero;
            Geom.Point3d end = new Geom.Point3d( 0, 0, 2 );
            Geom.Point3d px1 = new Geom.Point3d( 0.3, 0, 0.8 );
            Geom.Point3d px2 = new Geom.Point3d( -0.3, 0, 0.8 );
            Geom.Point3d py1 = new Geom.Point3d( 0, 0.3, 0.8 );
            Geom.Point3d py2 = new Geom.Point3d( 0, -0.3, 0.8 );
            top = sys.Globalize( top );
            end = sys.Globalize( end );
            px1 = sys.Globalize( px1 );
            px2 = sys.Globalize( px2 );
            py1 = sys.Globalize( py1 );
            py2 = sys.Globalize( py2 );

            using ( var scope = context.Push() ) {
              scope.Color = Color.White;
              context.DrawLineStrip( gl => gl.Vertices( end, top, px1, px2, top, py1, py2, top ) );
            }
              }
            );

              this.ActiveLightChanged( null, EventArgs.Empty );
              viewControl.Fit();
        }
Example #3
0
        /// <summary>
        /// 指定された <see cref="Graphics.DocumentViews"/> に対応する設定情報を取得します。
        /// 未登録の場合はインスタンスを生成・登録して返します。
        /// </summary>
        /// <param name="docviews"></param>
        /// <returns></returns>
        public static ViewSetting Get(Graphics.DocumentViews docviews)
        {
            ViewSetting instance = null;

            if (docviews != null && !_registry.TryGetValue(docviews, out instance))
            {
                instance = new ViewSetting(docviews);
                ViewSettingData.Instance.CopyTo(instance);
                _registry[docviews] = instance;
            }
            return(instance);
        }
Example #4
0
        protected void AddView(Graphics.IView view)
        {
            var setting = ViewSetting.Get(_docviews);

            if (setting.ShowCompass)
            {
                CompassScene.PutTo(view);                     // コンパス
            }
            if (setting.ShowRuler)
            {
                RulerScene.PutTo(view);                       // ルーラー
            }
            _docviews.AddView(view, this.ViewSetting.CreateViewOperation(() => _contextMenuFactory()));
        }
Example #5
0
 /// <summary>
 /// �w�肳�ꂽ <see cref="Graphics.DocumentViews"/> �ɑΉ�����ݒ����擾���܂��B
 /// ���o�^�̏ꍇ�̓C���X�^���X�𐶐��E�o�^���ĕԂ��܂��B
 /// </summary>
 /// <param name="docviews"></param>
 /// <returns></returns>
 public static ViewSetting Get( Graphics.DocumentViews docviews )
 {
     ViewSetting instance = null;
       if ( docviews != null && !_registry.TryGetValue( docviews, out instance ) ) {
     instance = new ViewSetting( docviews );
     ViewSettingData.Instance.CopyTo( instance );
     _registry[docviews] = instance;
       }
       return instance;
 }