Esempio n. 1
0
 public bool MouseMove(MouseEventArgs e)
 {
     if(bounds.Contains(e.Location))
     {
         bool overFlipButton;
         highlightedColormap = ColorMapFromPoint(e.Location, out overFlipButton);
         return true;
     }
     else
     {
         highlightedColormap = null;
         return false;
     }
 }
Esempio n. 2
0
            public void AddColorMap(NamedColorTable colormap)
            {
                ColorMapGroup group;
                if(!groups.TryGetValue(colormap.groupname, out group))
                    groups.Add(colormap.groupname, group = new ColorMapGroup(colormap.groupname));
                group.colormaps.Add(colormap);

                // Update group width and total width
                int newwidth = (int)Math.Ceiling(font.MeasureString(colormap.name).X);
                if(newwidth > group.width)
                {
                    group.width = newwidth;

                    totalwidth = 0;
                    foreach(ColorMapGroup g in groups.Values)
                        totalwidth += g.width;
                }
                totalheight = Math.Max(totalheight, HEADER_HEIGHT + group.colormaps.Count * ROW_HEIGHT + 4);
            }
Esempio n. 3
0
        /*~ColorTableManager()
        {
            System.IO.StreamWriter sw = new System.IO.StreamWriter(HISTORY_PATH);
            foreach(string h in history)
                sw.WriteLine(h);
            sw.Close();
        }*/
        private void AddColormap(NamedColorTable colormap)
        {
            colormaps.Add(colormap.name, colormap);
            if(colormap.groupname != "Solid" && !colormaps.ContainsKey("_default"))
                colormaps.Add("_default", colormap);

            picker.AddColorMap(colormap);
        }
Esempio n. 4
0
 private void ColorMapPicker_ColormapDragStart(NamedColorTable colormap)
 {
     draggedColormap = colormap;
 }
Esempio n. 5
0
            private void OnColormapDrop(NamedColorTable colormap, MouseEventArgs e)
            {
                float xr = Math.Min(Math.Max((float)(e.X - Bounds.X) / (float)Bounds.Width, 0.0f), 1.0f);

                Vector3 vpos = Vector3.Transform(new Vector3(2.0f * xr - 1.0f, 0.0f, 0.0f), invtransform);
                xr = vpos.X / 2.0f + 0.5f;

                //			highlightArea = null;
                /*bool done = false;
                foreach(Section section in sections)
                if(!done && section.start.pos <= xr && xr < section.end.pos)
                {
                    section.colorMap = colormap;
                    section.flipped = false;//colormap.flipped;
                    section.startValue = 0.0f;
                    section.endValue = 1.0f;
                    done = true;
                }
                ColormapChanged();*/
                for(int sectionIndex = 0; sectionIndex < sections.Count; ++sectionIndex)
                    if(sections[sectionIndex].start.pos <= xr && xr < sections[sectionIndex].end.pos)
                    {
                        ActionManager.Do(SetSectionColormapAction, new object[] { sectionIndex, colormap.name, colormap.flipped });
                        break;
                    }
            }