Пример #1
0
        //============================================================
        // <T>缩放资源设置。</T>
        //============================================================
        private void tsbScale_Click(object sender, EventArgs e)
        {
            UncheckScaleButtons();
            ToolStripButton button = sender as ToolStripButton;
            float           scale  = 0;

            if (null != button)
            {
                string tag = button.Tag.ToString();
                if (tag == "Auto")
                {
                    qpbViewer.ScaleMode     = EPictureBoxMode.Auto;
                    tsbScaleAuto.Checked    = true;
                    tsbScaleAuto.CheckState = CheckState.Checked;
                }
                else
                {
                    scale = RFloat.Parse(tag);
                    if (scale < 1.0f)
                    {
                        qpbViewer.ScaleMode  = EPictureBoxMode.Scale;
                        qpbViewer.ScaleValue = scale;
                    }
                    else
                    {
                        qpbViewer.ScaleMode  = EPictureBoxMode.ScalePixel;
                        qpbViewer.ScaleValue = (float)((int)scale);
                    }
                    ((ToolStripButton)sender).Checked    = true;
                    ((ToolStripButton)sender).CheckState = CheckState.Checked;
                }
            }
        }
Пример #2
0
 //============================================================
 // <T>存储光源信息。</T>
 //
 // @param light 光源信息
 //============================================================
 public void SaveLight()
 {
     // 存储属性
     _light.TypeName = txtName.Text;
     // 存储设置
     _light.OptionTrack = qdrOptionTrack.DataValue;
     // 存储材质
     _light.Material.ColorMin = RFloat.Parse(txtMinColor.Text.Trim());
     _light.Material.ColorMax = RFloat.Parse(txtMaxColor.Text.Trim());
     _light.Material.AmbientColor.Assign(qdcAmbient.ColorValue);
     _light.Material.AmbientShadow = RFloat.Parse(txtAmbientShadow.Text.Trim());
     _light.Material.DiffuseColor.Assign(qdcDiffuse.ColorValue);
     _light.Material.DiffuseShadow = RFloat.Parse(txtDeffuseShadow.Text.Trim());
     _light.Material.DiffuseViewColor.Assign(qdcDiffuseView.ColorValue);
     _light.Material.DiffuseViewShadow = RFloat.Parse(txtDeffuseViewShadow.Text.Trim());
     _light.Material.SpecularColor.Assign(qdcSpecular.ColorValue);
     _light.Material.SpecularBase    = RFloat.Parse(txtSpecularBase.Text.Trim());
     _light.Material.SpecularRate    = RFloat.Parse(txtSpecularRate.Text.Trim());
     _light.Material.SpecularShadow  = RFloat.Parse(txtSpecularShadow.Text.Trim());
     _light.Material.SpecularAverage = RFloat.Parse(txtSpecularAverage.Text.Trim());
     _light.Material.SpecularViewColor.Assign(qdcSpecular.ColorValue);
     _light.Material.SpecularViewBase    = RFloat.Parse(txtSpecularViewBase.Text.Trim());
     _light.Material.SpecularViewRate    = RFloat.Parse(txtSpecularViewRate.Text.Trim());
     _light.Material.SpecularViewAverage = RFloat.Parse(txtSpecularViewAverage.Text.Trim());
     _light.Material.SpecularViewShadow  = RFloat.Parse(txtSpecularViewShadow.Text.Trim());
     _light.Material.OpacityColor.Assign(qdcOpacityColor.ColorValue);
     _light.Material.ReflectColor.Assign(qdcReflect.ColorValue);
     _light.Material.RefractFrontColor.Assign(qdcRefractFront.ColorValue);
     _light.Material.RefractBackColor.Assign(qdcRefractBack.ColorValue);
     _light.Material.EmissiveColor.Assign(qdcEmissive.ColorValue);
 }
Пример #3
0
 //============================================================
 // <T>保存材质信息。</T>
 //
 // @param material 材质信息
 //============================================================
 public void SaveMaterial(FDrMaterial material = null)
 {
     // 修改默认材质
     if (material == null)
     {
         material = _material;
     }
     if (material == null)
     {
         return;
     }
     // 存储配置
     material.AlphaBase = RFloat.Parse(txtAlphaBase.Text);
     material.AlphaRate = RFloat.Parse(txtAlphaRate.Text);
     // 存储颜色
     material.AmbientColor.Assign(qdcAmbient.ColorValue);
     material.AmbientShadow = RFloat.Parse(txtAmbientShadow.Text);
     material.DiffuseColor.Assign(qdcDiffuse.ColorValue);
     material.DiffuseShadow = RFloat.Parse(txtDiffuseShadow.Text);
     material.DiffuseViewColor.Assign(qdcDiffuseView.ColorValue);
     material.DiffuseViewShadow = RFloat.Parse(txtDiffuseViewShadow.Text);
     material.SpecularColor.Assign(qdcSpecular.ColorValue);
     material.SpecularShadow = RFloat.Parse(txtSpecularShadow.Text);
     material.SpecularViewColor.Assign(qdcSpecularView.ColorValue);
     material.SpecularViewShadow = RFloat.Parse(txtSpecularViewShadow.Text);
     material.EmissiveColor.Assign(qdcEmissive.ColorValue);
 }
Пример #4
0
 //============================================================
 // <T>确定按钮事件处理。</T>
 //============================================================
 private void btnAccept_Click(object sender, System.EventArgs e)
 {
     _layer.ScrollCd    = REnum.ToValue <EMapLayerScroll>(cbxScrollCd.Text);
     _layer.TypeCd      = REnum.ToValue <EMapLayerType>(cbxTypeCd.Text);
     _layer.ScrollSpeed = RFloat.Parse(txtSpeed.Text);
     _layer.WrapCd      = REnum.ToValue <EMapLayerWrap>(cbxWrapCd.Text);
     Close();
 }
Пример #5
0
 //============================================================
 // <T>解析数据。</T>
 //
 // @param source 来源
 //============================================================
 public void Parse(string source)
 {
     string[] values = source.Split(',');
     if (3 == values.Length)
     {
         X = RFloat.Parse(values[0]);
         Y = RFloat.Parse(values[1]);
         Z = RFloat.Parse(values[2]);
     }
 }
Пример #6
0
 //============================================================
 // <T>存储场景区域信息。</T>
 //============================================================
 public void SaveRegion()
 {
     // 存储属性
     _region.Color.Assign(qdcColor.ColorValue);
     _region.FogColor.Assign(qdcFogColor.ColorValue);
     _region.FogNear        = RFloat.Parse(txtFogNear.Text);
     _region.FogFar         = RFloat.Parse(txtFogFar.Text);
     _region.FogRate        = RFloat.Parse(txtFogRate.Text);
     _region.FogAttenuation = RFloat.Parse(txtFogAttenuation.Text);
 }
Пример #7
0
 //============================================================
 // <T>根据属性名称,获得整数属性内容。</T>
 //
 // @param name 属性名称
 // @param defaultValue 默认内容
 // @return 属性内容
 //============================================================
 public float GetFloat(string name, float defaultValue)
 {
     if (null != _attributes)
     {
         string value = _attributes.Find(name);
         if (!RString.IsEmpty(value))
         {
             return(RFloat.Parse(value));
         }
     }
     return(defaultValue);
 }
Пример #8
0
 //============================================================
 // <T>解析字符串。</T>
 //
 // @param value 字符串
 //============================================================
 public virtual void Parse(string value)
 {
     string[] data = value.Split(',');
     if (2 == data.Length)
     {
         Width  = RFloat.Parse(data[0]);
         Height = RFloat.Parse(data[1]);
     }
     else
     {
         throw new FFatalException("Invalid size format ({0})", value);
     }
 }
Пример #9
0
 //============================================================
 // <T>获得当前选中缩放比率。</T>
 //============================================================
 private void RefreshScaleInfo()
 {
     foreach (ToolStripButton button in scaleButtons)
     {
         if (button.Checked)
         {
             string tag = button.Tag.ToString();
             if ("Auto" == tag)
             {
                 qpbViewer.ScaleMode = EPictureBoxMode.Auto;
             }
             else
             {
                 qpbViewer.ScaleMode  = EPictureBoxMode.ScalePixel;
                 qpbViewer.ScaleValue = RFloat.Parse(tag);
             }
         }
     }
 }
Пример #10
0
 //============================================================
 // <T>缩放内容处理。</T>
 //
 // @param sender 发送者
 // @param e 事件
 //============================================================
 private void tsbScale_Click(object sender, EventArgs e)
 {
     foreach (ToolStripItem item in tsResource.Items)
     {
         if (item is ToolStripButton)
         {
             ToolStripButton button = item as ToolStripButton;
             if (!button.Equals(sender))
             {
                 button.Checked = false;
             }
             else
             {
                 button.Checked = true;
             }
         }
     }
     if (null != qpbImage.Bitmap)
     {
         ToolStripButton button     = sender as ToolStripButton;
         string          typeString = button.Tag.ToString();
         if (typeString.Equals("Auto"))
         {
             qpbImage.ScaleMode = EPictureBoxMode.Auto;
             return;
         }
         float scale = RFloat.Parse(button.Tag.ToString());
         if (scale > 1)
         {
             qpbImage.ScaleMode = EPictureBoxMode.ScalePixel;
         }
         else
         {
             qpbImage.ScaleMode = EPictureBoxMode.Scale;
         }
         qpbImage.ScaleValue = scale;
     }
 }
Пример #11
0
 //============================================================
 // <T>在当前节点下,查找指定节点名称的浮点内容。</T>
 //
 // @param name 节点名称
 // @param args 属性列表
 // @return 节点内容
 //============================================================
 public float FindFloat(string name)
 {
     return(RFloat.Parse(FindText(name)));
 }
Пример #12
0
 //============================================================
 // <T>根据属性名称,获得浮点属性内容。</T>
 //
 // @param name 属性名称
 // @return 属性内容
 //============================================================
 public float GetFloat(string name)
 {
     return(RFloat.Parse(Get(name)));
 }
Пример #13
0
        //============================================================
        // <T>获得指定名称的浮点数内容。</T>
        //
        // @param name 名称
        // @return 内容
        //============================================================
        public float GetAsFloat(string name, float defaultValue)
        {
            string value = Get(name);

            return((null != value) ? RFloat.Parse(value) : defaultValue);
        }
Пример #14
0
 //============================================================
 private void tsbScale_Click(object sender, EventArgs e)
 {
     ToolStripButton button = sender as ToolStripButton;
     float           scale  = RFloat.Parse(button.Tag.ToString());
     //qdcPicture.ChangeSize(scale);
 }