Commit e86c0e01 authored by Denis Khachko's avatar Denis Khachko

Draw net fix .

parent 522fa138
...@@ -689,14 +689,17 @@ void DrawView::resizeEvent ( QResizeEvent * event ) ...@@ -689,14 +689,17 @@ void DrawView::resizeEvent ( QResizeEvent * event )
} }
if(pixel_per_cell<15) if(pixel_per_cell<15)
{ {
stepX=DRAW->NetStepX()*2; while(pixel_per_cell<15){
stepY=DRAW->NetStepX()*2; pixel_per_cell=stepX/(1/c_scale);
//if(stepX>5)stepX=(int)(stepX-0.5);
//if(stepY>5)stepY=(int)(stepY-0.5); stepX=stepX*1.5;
stepY=stepY*1.5;
}
DRAW->setNetStepX(stepX); DRAW->setNetStepX(stepX);
DRAW->setNetStepY(stepY); DRAW->setNetStepY(stepY);
DRAW->drawNet(); DRAW->drawNet();
//DRAW->scalePen(1.2);
} }
DRAW->setNetStepX(stepX); DRAW->setNetStepX(stepX);
...@@ -708,7 +711,7 @@ void DrawView::resizeEvent ( QResizeEvent * event ) ...@@ -708,7 +711,7 @@ void DrawView::resizeEvent ( QResizeEvent * event )
else else
{ {
double pixel_per_cell=DRAW->NetStepX()/(1/c_scale); double pixel_per_cell=DRAW->NetStepX()/(1/c_scale);
if(!net)pixel_per_cell=lastStep/(1/c_scale); //if(!net)pixel_per_cell=lastStep/(1/c_scale);
if(pixel_per_cell<15) //Net step too short if(pixel_per_cell<15) //Net step too short
{ {
net=false; net=false;
...@@ -720,8 +723,8 @@ void DrawView::resizeEvent ( QResizeEvent * event ) ...@@ -720,8 +723,8 @@ void DrawView::resizeEvent ( QResizeEvent * event )
{ {
net=true; net=true;
smallNetLabel->hide(); smallNetLabel->hide();
DRAW->setNetStepX(lastStep); // DRAW->setNetStepX(lastStep);
DRAW->setNetStepY(lastStep); // DRAW->setNetStepY(lastStep);
} }
if(pixel_per_cell>this->width()*2) if(pixel_per_cell>this->width()*2)
{ {
...@@ -1128,15 +1131,19 @@ void DrawModule::drawNet() ...@@ -1128,15 +1131,19 @@ void DrawModule::drawNet()
CurView->setZoom(50); CurView->setZoom(50);
CurView->setNet();
mPen->setScale(0.05); mPen->setScale(0.05);
setNetStepX(1);
setNetStepY(1);
CurView->centerOn(3,-3); CurView->centerOn(3,-3);
if(isAutoNet())
{
setNetStepX(1);
setNetStepY(1);
navigator->updateSelf(1,1);
}
CurView->setNet(); CurView->setNet();
drawNet(); drawNet();
navigator->updateSelf(1,1);
}; };
void DrawModule::zoomFullDraw() void DrawModule::zoomFullDraw()
...@@ -1241,9 +1248,15 @@ void DrawModule::drawNet() ...@@ -1241,9 +1248,15 @@ void DrawModule::drawNet()
void DrawModule::netStepChange(double value) void DrawModule::netStepChange(double value)
{ {
double oldValue=NetStepY(); double oldValue=NetStepY();
setNetStepY(value); setNetStepY(value);
setNetStepX(value); setNetStepX(value);
if(oldValue!=value && value>navigator->netStepYS->minimum() )drawNet();
if(oldValue!=value && value!=0)
{
getCurView()->setNet();
drawNet();
}
} }
void DrawModule::redraw() void DrawModule::redraw()
{ {
......
...@@ -77,12 +77,12 @@ DrawNavigator::DrawNavigator( QWidget * parent ){ ...@@ -77,12 +77,12 @@ DrawNavigator::DrawNavigator( QWidget * parent ){
void DrawNavigator::XvalueChange(double value) void DrawNavigator::XvalueChange(double value)
{ {
emit netStepChange(value);
netStepYS->setSingleStep(value/10); netStepYS->setSingleStep(value/10);
netStepXS->setSingleStep(Zoom/500); netStepXS->setSingleStep(Zoom/500);
qDebug()<<"Zoom"<<Zoom<<" Step"<<netStepXS->singleStep(); qDebug()<<"Zoom"<<Zoom<<" Step"<<netStepXS->singleStep();
netStepYS->setValue(value); netStepYS->setValue(value);
emit netStepChange(value);
} }
void DrawNavigator::YvalueChange(double value) void DrawNavigator::YvalueChange(double value)
......
...@@ -40,8 +40,8 @@ public: ...@@ -40,8 +40,8 @@ public:
} }
void updateSelf(double netStepX,double netStepY) void updateSelf(double netStepX,double netStepY)
{ {
if(50/Zoom>=1)zoomText->setPlainText("1:"+QString::number(50/Zoom)); if(50/Zoom>=1)zoomText->setPlainText("1:"+QString::number(50/Zoom,'f',2));
else zoomText->setPlainText(QString::number(Zoom/50)+":1"); else zoomText->setPlainText(QString::number(Zoom/50,'f',2)+":1");
qDebug()<<"Zoom"<<Zoom; qDebug()<<"Zoom"<<Zoom;
//double pixel_per_cell=DRAW->NetStepX()/(1/c_scale); //double pixel_per_cell=DRAW->NetStepX()/(1/c_scale);
if(isAutonet->isChecked()){ if(isAutonet->isChecked()){
...@@ -55,6 +55,12 @@ public: ...@@ -55,6 +55,12 @@ public:
netStepXS->setSingleStep(Zoom/500); netStepXS->setSingleStep(Zoom/500);
}else
{
netStepXS->setMaximum(99999);
netStepXS->setMinimum(0.00001);
// netStepXS->setValue(netStepX);
// netStepYS->setValue(netStepY);
} }
update(); update();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment