T O P I C R E V I E W |
Thermoss |
Posted - 05/26/2011 : 04:13:16 AM 8.1 SR1 XP Pro
Helo,
I try to change the z-scale for IMAGE plots (but don´t want to change the color settings). My Template look´s like
If I try to fix the scale to 40-60 by using
vector vLevels; const double min = 40; const double max = 60; const int nLevels = 20; double inc = (max - min) / (nLevels - 1); vLevels.Data(min, max,inc);
vector<uint> vnColors; vnColors.GetSize() == vLevels.GetSize() - 1 vnColors.Data(0, nLevels-2,1); DataPlot dp = gl.DataPlots(nPlot);
I get
As you see, the scale ist right to 40 - 60 but the colour has changed also but is not wanted.
If I change manually in the following dialog box gray to yellow I get my wanted result
What I want is "Farben zu Mischung hinzufügen" but only from black to yellow and not from black to grey.
How is the program code for this?
Thanks in advance Pet
|
7 L A T E S T R E P L I E S (Newest First) |
Iris_Bai |
Posted - 08/23/2012 : 11:40:30 PM Hi Pet,
We cannot setup below color and above color for Image Plot. Double-click on Graph window to open Plot Details dialog, Colormap tab, move mouse in Fill... column, the cursor will be changed to a "hand" except the first row and the last row, and click on the two rows, cannot open Fill dialog.
We can setup above color and below color in Color Fill Contour Graph. Please open Plot Details dialog to try.
To setup the color map for Image Plot, you can save a palette and load by: Tree tr; tr.ColorMap.Palette.strVal = "Green.PAL";
Iris
|
Thermoss |
Posted - 08/23/2012 : 08:53:29 AM Origin V8.1.13.88 Windows 7
Hi Iris,
I could narrow down the problem a little more. Beneath is my complete code to create a IMAGE-Plot form a existing Matrix.
As you can see I used tr.Details.BelowColor.nVal = SYSCOLOR_RED; instead of your advice: tr.ColorMap.Details.BelowColor.nVal = SYSCOLOR_RED; I did this because after getting the ColorMap with dp.GetColormap(tr) I saw that this will be the correct notation.
By the code beneath it is possible to change Min and Max values. But it is not possible to change ...Details.BelowColor.nVal. In the variable window I can see, that the values are changed, but in the end the image didn´t shows the result. After getting the tree again with dp.GetColormap(tr) the values or BelowColor and AboveColor are agein (-4) like in the beginning. Wy is the correct value not accepted?
void Image_Plot_2() { MatrixLayer ml = Project.ActiveLayer(); if(!ml) return; MatrixObject mo = ml.MatrixObjects(0); if(!mo) return; GraphPage gp; gp.Create("Image"); // need use Image template here if(!gp) return; GraphLayer gl = gp.Layers(0); int nPlot = gl.AddPlot(mo, IDM_PLOT_MATRIX_IMAGE); if(nPlot < 0) { out_str("Fail to plot image plot"); return; } vector vLevels;
DataPlot dp = gl.DataPlots(0);
double mmin, mmax; mmin = Minvalue; //120; mmax = Maxvalue; //150;
Tree tr; dp.GetColormap(tr);
tr.Details.BelowColor.nVal = SYSCOLOR_RED; tr.Details.AboveColor.nVal = SYSCOLOR_BLUE; tr.Min.dVal = mmin; tr.Max.dVal = mmax; // tr.MajorLevels.dVal = 500;
if(!dp.SetColormap(tr)) { printf("Fail to set colormap\n"); return; }
dp.GetColormap(tr); gl.GetPage().Refresh(true); }
Best Pet |
Thermoss |
Posted - 08/22/2012 : 12:46:05 PM Hi Iris,
Thank You again for your Answer. But unfortunately it does not work.
I changed SYSCOLOR_BLACK to SYSCOLOR_RED, but no change.
I also tryed to import the colormap to the Tree first and changing some values after that like
Tree tr; dp.GetColormap(tr); tr.ColorMap.Details.BelowColor.nVal = SYSCOLOR_RED; tr.ColorMap.Details.AboveColor.nVal = SYSCOLOR_BLUE; tr.ColorMap.Min.nVal = 5;
I made a brakepoint and looked to the variable window. But the Values didn't change.
Even not after the following code
if( 0 == dp.UpdateThemeIDs(tr) ) // to update theme ids to tree node { dp.SetColormap(tr); // apply settings gl.GetPage().Refresh(true); // refresh graph }
by the way, I didn't understand the term 0 == dp.UpdateThemeIDs(tr) for what is this needed?
any further hints? Thanks in advance Pete |
Iris_Bai |
Posted - 07/05/2012 : 11:19:45 PM Hi Pet,
You need to change the below color and above color. The two colors not be included in color list, and use the specified tree node to control them. See sample codes below.
void test_colormap()
{
GraphLayer gl = Project.ActiveLayer();
DataPlot dp = gl.DataPlots(0);
Tree tr;
tr.ColorMap.Details.BelowColor.nVal = SYSCOLOR_BLACK;
tr.ColorMap.Details.AboveColor.nVal = SYSCOLOR_BLACK;
if( 0 == dp.UpdateThemeIDs(tr) ) // to update theme ids to tree node
{
dp.SetColormap(tr); // apply settings
gl.GetPage().Refresh(true); // refresh graph
}
}
Iris |
Thermoss |
Posted - 07/05/2012 : 10:21:49 AM Hi again, don´t know wy my pictures are not shown. Maybe you will understand my question without them?
Pet |
Thermoss |
Posted - 07/05/2012 : 10:17:52 AM Hi Iris, thank you for your hint. I tried as you told me. It worked alomost perfect. But one small thing is still open. As you can see in the 2. picture below the upermost pixel in the scale is black instead of yellow as I want to be. This leads to black pixels in the image if their value is higher than 63. I don´t want that. My template has colour setting from black zu yelow.
But after my code ... mmin = mmin2; //4000; mmax = mmax2; //9000; double iinc = (mmax - mmin) / nnLevels; vZs.Data(mmin, mmax, iinc); dpp.SetColormap(vZs); ...
the colour setting ist from black to black. How can I prevent this?
thanks again in advance Pet |
Iris_Bai |
Posted - 06/01/2011 : 9:46:16 PM Hi Pet,
Please use DataPlot::SetColormap( const vector<double> & vz, BOOL bLogScale = FALSE ); to set z scale only. Do not use DataPlot::SetColormap( TreeNode & trColormap ).
See examples.
Iris |