//------------------------------------------------
void HistogramView::Process()
{
-printf("EED HistogramView::Process Start \n");
if (firsttime==true)
{
firsttime=false;
// histogram_wxwidget = new Histogram( wxpanel , -1, wxPoint(0,0), wxSize(400,400),wxNO_BORDER );
_histogramMinMaxLevel->Configure( bbGetInputIn() );
}
-printf("EED HistogramView::Process End \n");
}
//------------------------------------------------
}
// EO namespace bbcreaMaracasVisu
-
// if (firsttime==true)
// {
// firsttime=false;
-
-
- printf("EED PlotterView::Process %d %d \n ", bbGetInputInY().size(),bbGetInputInY2().size());
-
+
pGraphicalFunction *pGF = mwxwidget->getFunction(0);
pGraphicalFunction *pGF2 = mwxwidget->getFunction(1);
} // if bbGetInputInY
// } // if firsttime
+
if (pGF!=NULL)
{
}
}// if pGF
-
if (pGF2!=NULL)
{
// -Erasing points-
int i,sizePoints = pGF2->getSizePoints();
for (i=0; i<sizePoints;i++)
{
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
pGF2->deletePointAt(1); // EED here NOT 0 is 1
+#else
+ pGF2->deletePointAt(0); // EED here NOT 0 is 1
+#endif
} // for i
// -Add Points-
double px;
px = i;
}
pGF2->AddNewPoint( px, bbGetInputInY2()[i] );
- }
+ } // for
}// if pGF
-
mwxwidget->UpdateAll();
-
-
}
//---------------------------------------------------
void PlotterView::CreateWidget(wxWindow* parent)
{
- bbtkDebugMessageInc("Core",9,"PlotterView::CreateWxWindow()"<<std::endl);
-
- mwxwidget = new pPlotterWindow( parent , -1,wxDefaultPosition, wxDefaultSize, 0 );
- mwxwidget->AddLayer(new pPlotterScaleX());
- mwxwidget->AddLayer(new pPlotterScaleY());
-
+ bbtkDebugMessageInc("Core",9,"PlotterView::CreateWxWindow()"<<std::endl);
+ mwxwidget = new pPlotterWindow( parent , -1,wxDefaultPosition, wxDefaultSize, 0 );
+ mwxwidget->AddLayer(new pPlotterScaleX());
+ mwxwidget->AddLayer(new pPlotterScaleY());
mwxwidget->setMinScrY(0);
mwxwidget->setMaxScrY(5000);
-
-
- bbtkDebugDecTab("Core",9);
- bbSetOutputWidget( mwxwidget );
+ bbtkDebugDecTab("Core",9);
+ bbSetOutputWidget( mwxwidget );
}
//---------------------------------------------------
# ------------------------------------------------------------------------ */
//----------------------------------------------------------------------------
+#include <wx/brush.h>
+#include <wx/gdicmn.h>
+
#include "mBarRange.h"
_initialPoint = 0;
trianglesHalfWidth = 5;
- wxColour start_Colour;
// Setting the default parts colors
- start_Colour = wxColour(0,0,255);
+ start_Colour = wxColour(1,0,255,254);
actual_Colour = wxColour(255,255,202);
end_Colour = wxColour(0,0,255);
bar_Colour = wxColour(255,0,255);
int pxEnd = GetPixelEnd();
int pxActual = GetPixelActual();
-
int letterHeight= 9;
int barHeight = 2*letterHeight;
- int tempHeight = _h-(6*letterHeight);
-
+ int tempHeight = _h-(6*letterHeight);
if (_visibleLables)
{
wxMemoryDC temp_dc;
temp_dc.SelectObject( *_bitmap_bar );
-
// Background of this widget
-
-
temp_dc.SetPen(wxPen( backgroundColor ));
temp_dc.SetBrush(wxBrush( backgroundColor ,wxSOLID ));
-
temp_dc.DrawRectangle(0,0,_w+2*trianglesHalfWidth,_h);
-
-
temp_dc.SetPen(wxPen( wxColour(167,165,191) ,1,wxSOLID ));
temp_dc.DrawLine(trianglesHalfWidth+2, 0, _w-deviceEndMargin, 0);
temp_dc.DrawLine(trianglesHalfWidth+2, barHeight, (_w-deviceEndMargin-trianglesHalfWidth-2), barHeight);
temp_dc.SetDeviceOrigin(trianglesHalfWidth+2,0);
-
// Filling the bar
temp_dc.SetBrush(wxBrush( wxColour(104,104,104),wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(104,104,104),1,wxSOLID ));
temp_dc.DrawRectangle( pxStart , 0, pxEnd-pxStart, barHeight);
-
// The Bar
if( _selectionMoveId==4 )
{
temp_dc.SetBrush(wxBrush( wxColour(128,255,0),wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(0,128,0),1,wxSOLID ));
- }
- else
- {
+ } else {
temp_dc.SetBrush(wxBrush( bar_Colour,wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(164,0,164),1,wxSOLID ));
}
{
temp_dc.SetBrush(wxBrush( wxColour(128,255,0),wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(0,128,0),1,wxSOLID ));
- }
- else
- {
+ } else {
temp_dc.SetBrush(wxBrush( start_Colour,wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(0,51,204),1,wxSOLID ));
}
{
temp_dc.SetBrush(wxBrush( wxColour(128,255,0),wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(0,128,0),1,wxSOLID ));
- }
- else
- {
+ } else {
temp_dc.SetBrush(wxBrush( end_Colour,wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(0,0,255),1,wxSOLID ));
}
{
temp_dc.SetBrush(wxBrush( wxColour(128,255,0),wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(0,128,0),1,wxSOLID ));
- }
- else
- {
+ } else {
temp_dc.SetBrush(wxBrush( actual_Colour,wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(205,160,5),1,wxSOLID ));
}
temp_dc.SetFont(font);
temp_dc.SetTextForeground(*wxBLACK);
-
//the **MIN** value, always at the same y level that corresponds to barHeight+1
wxString text_min;
// text_min<< GetMin();
temp_dc.DrawText(text_actual, pxActual-(stringSize.GetWidth()/2),barHeight+letterHeight);
}
}
-
}
//----------------------------------------------------------------------------
pGraphicalFunction:: pGraphicalFunction(wxString name, int flags)
{
SetName(name);
- showPointsF = false;
- validPointRange = 5;
- logicFunction = new pLogicalFunction ();
- fromWindow=false;
- factorZoom=1;
- drawing=false;
- editable=true;
- ifActual=false;
- zoomIn=false;
- setOffsetX(0);
+ showPointsF = false;
+ validPointRange = 5;
+ logicFunction = new pLogicalFunction ();
+ fromWindow = false;
+ factorZoom = 1;
+ drawing = false;
+ editable = true;
+ ifActual = false;
+ zoomIn = false;
+ setOffsetX(0) ;
setOffsetY(0);
- initialDrawingPoint=NULL;
- finalDrawingPoint=NULL;
+ initialDrawingPoint = NULL;
+ finalDrawingPoint = NULL;
//type=1 means that is going to be a piecewise function
- _type=1;
- xKSpline=NULL;
- yKSpline=NULL;
- offsetPixelX=0;
- offsetPixelY=0;
- xTraslation=0;
- mType=DEFAULT;
+ _type = 1;
+ xKSpline = NULL;
+ yKSpline = NULL;
+ offsetPixelX = 0;
+ offsetPixelY = 0;
+ xTraslation = 0;
+ mType = DEFAULT;
}
{
bool added=logicFunction -> deletePointAt( index );
if(!fromWindow)
- setUp();
- else
{
+ setUp();
+ } else {
logicFunction->setEndPoints();
logicFunction->setStartPoints();
}
}
return false;
}
+
+
+
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
/**
Get Point list of the funcion
@param return points
logicFunction->GetPoints(points);
//points = realPoints;
}
+#else
+ /**
+ Get Point list of the funcion
+ @param return pointsPtr
+ */
+ virtual wxList* GetPointsPtr()
+ {
+ return logicFunction->GetPointsPtr();
+ }
+#endif
+
+
/**
Get the point where the user
made a click
*/
-
virtual void getMousePoint(int &x,int &y)
{
- x=mousePoint.x;
- y=mousePoint.y;
+ x = mousePoint.x;
+ y = mousePoint.y;
}
/**
void pHistogram::setPoints(vtkImageData* imageData)
{
-printf("EED pHistogram::setPoints Trinng new histogram ..\n");
/*
printf("EED pHistogram::setPoints Test: vtkPComputeHistogram2DOutliers\n");
vtkComputeHistogram2DOutliers *vtkhist = vtkComputeHistogram2DOutliers::New();
}
*/
+
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
/**
Get Point list of the funcion
@param return points
{
points = realPoints;
}
+#else
+ /**
+ Get Point list of the funcion
+ @param return pointsPtr
+ */
+ /*virtual*/
+ wxList* GetPointsPtr()
+ {
+ return &realPoints;
+ }
+#endif
+
+
/*
* validate if the function has that point in a sensible area returning the index where the point was found or -1 if is in not part of the function: define the sensible area is
* x1-validPointRange<x<x1+validPointRange y1-validPointRange<y<y1+validPointRange
{
SetName(name);
m_flags = flags;
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
points.DeleteContents(TRUE);
- offsetX=0;
- offsetY=0;
+#else
+ // ...
+#endif
+ offsetX = 0;
+ offsetY = 0;
}
/*
*/
void pPlotterLayer::drawFunction(wxDC & dc,mpWindow & w, int orgy)
{
-
-
int scrwX,scrwY,offsetpx,offsetpy,maxX,minX,maxY,minY;
- wxPoint* ppoints=NULL;
+ wxPoint* ppoints = NULL;
/*
This is the offset of every point scale to the window
pixel
*/
- offsetpx=getOffsetPixelsXv();
- offsetpy=getOffsetPixelsYv();
-
+ offsetpx = getOffsetPixelsXv();
+ offsetpy = getOffsetPixelsYv();
Rewind();
-
dc.GetSize(&scrwX, &scrwY);
-
//Lines between the points
-
int sizedc = dc.GetSize().GetHeight()-orgy;
-
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
GetPoints(points);
-
+#else
+ //...
+#endif
// type of plotter
int type=getmType();
/***********/
//traslation
//int xTraslation=getXTraslation(); //JPRx
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
wxNode* node= points.GetFirst();
+#else
+ wxNode* node= GetPointsPtr()->GetFirst();
+#endif
// int i=1;//points.GetCount()+1; //JPRx
int j=2;
/*
/*
Fill the function if it represented an histogram
*/
- ppoints=(wxPoint*)malloc(sizeof(int)*2*(points.GetCount()+2));
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+ ppoints = (wxPoint*)malloc(sizeof(int)*2*(points.GetCount()+2));
+#else
+ ppoints = (wxPoint*)malloc(sizeof(int)*2*(GetPointsPtr()->GetCount()+2));
+#endif
//initialize points
- point.x=-5000;
- point.y=GetYTranslated(sizedc,-5000);
- ppoints[0]=point;
- ppoints[1]=point;
-
+ point.x = -5000;
+ point.y = GetYTranslated(sizedc,-5000);
+ ppoints[0] = point;
+ ppoints[1] = point;
}
-
while (node!=NULL && node->GetNext()!=NULL)
{
pFunctionPoint* pointi=(pFunctionPoint*)node->GetData();
int pyi=(pointi->getRealY()-minY)-offsetY;
int pxj=(pointj->getRealX()-minX)-offsetX;
int pyj=(pointj->getRealY()-minY)-offsetY;
-
-
int cxi=pxi* scaleX + offsetpx; //+ xTraslation;
int cxj=pxj* scaleX + offsetpx; //+ xTraslation;
int cyi=pyi* scaleY+ offsetpy ;
int cyj=pyj* scaleY+ offsetpy ;
//dc.DrawLine(pxi* scaleX + offsetpx,pyi* scaleY+ offsetpy, pxj* scaleX + offsetpx,pyj* scaleY+ offsetpy );
if(type!=2)
+ {
draw(dc,w,pxi* scaleX + offsetpx,pyi* scaleY+ offsetpy, pxj* scaleX + offsetpx,pyj* scaleY+ offsetpy,orgy );
//dc.DrawLine(pxi* scaleX + offsetpx,pyi* scaleY+ offsetpy, pxj* scaleX + offsetpx,pyj* scaleY+ offsetpy );
- else if(type==2)
- {
+ } else if(type==2) {
if(!initializePolygon(ppoints,cxi,cyi,cxj,cyj) && ((cxi<=0 && cxj>=0)||(cxi>=0 && cxj>=0)))
{
point.x=cxj;
ppoints[j]=point;
j++;
- }
- }
-
+ } // if
+ } // if type
node=node->GetNext();
-
}
if(type==2)
{
dc.SetPen(wxPen( wxColour(0,0,0) ,1,wxSOLID ));
//dc.DrawPolygon(vx.size()+2,ppoints,0,0);
dc.DrawPolygon(j+2,ppoints,0,0);
-
- }
-
+ } // if type
}
/**
getDirection(direction);
getSize(sizeP);
//Lines betwen the points
- GetPoints(points);
- wxNode *node=points.GetLast();
- wxNode *node1=points.GetFirst();
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+ GetPoints(points);
+ wxNode *node = points.GetLast();
+ wxNode *node1 = points.GetFirst();
+#else
+ wxNode *node = GetPointsPtr()->GetLast();
+ wxNode *node1 = GetPointsPtr()->GetFirst();
+#endif
/*
GetYTranslated(sizedc,(realY_guide/*-w.getMinScrY()*/-offsetX)*scaleX + offsetpx),
scrwX,
GetYTranslated(sizedc,(realY_guide/*-w.getMinScrY()*/-offsetX)*scaleX + offsetpx));
- }
- }
-
+ } // if realY_guide
+ } // if actual
}
*/
virtual bool GetNextXY(double & x, double & y){return false;}
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
/**
Get Point list of the funcion
@param return points
*/
virtual void GetPoints(wxList &points){}
+#else
+ /**
+ Get Point list of the funcion
+ @param return points
+ */
+ virtual wxList* GetPointsPtr(){ }
+#endif
+
/** Layer plot handler.
This implementation will plot the locus in the visible area and
protected:
int m_flags; //!< Holds label alignment
+
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
/*
* Points of the function thats is drawing
*/
wxList points;
+#else
+ // use GetPointsPtr()
+#endif
+
/*
* the scale in x, with wich it must draw
*/
//----------------------------------------------------------------------------
// Methods
//----------------------------------------------------------------------------
-pPlotterScaleX::pPlotterScaleX(wxString aName,int flags) {
-
+pPlotterScaleX::pPlotterScaleX(wxString aName,int flags)
+{
SetName(aName);/*
SetFont(*wxSMALL_FONT);
SetPen(*wxGREY_PEN);*/
*/
pGraphicalFunction* pPlotterWindow::getFunction(int index)
{
- wxNode* node=functions.Item(index);
- if(node==NULL){
+ wxNode* node=NULL;
+ if (functions.size()>index)
+ {
+ node=functions.Item(index);
+ } // if
+
+ if(node==NULL)
+ {
return NULL;
- }
+ } // if node
return (pGraphicalFunction*)node->GetData();
}
+
+
/*
move the functions that the user wants to move
and that were set in functionsToMove
@param porcentageMaxX:the percentage that the maxShowed
of the functions have to be move
0<=porcentageMaxX<=1
-
*/
-
void pPlotterWindow::moveFunctions( float porcentageMinX,float porcentageMaxX)
{
//Adding the actual function
*/
wxTextCtrl *m_log;
- wxString text;
+ wxString text;
/*
Functions to be move at the same time