KiCad PCB EDA Suite
panel_prev_model.cpp File Reference
#include <3d_canvas/eda_3d_canvas.h>
#include <common_ogl/cogl_att_list.h>
#include <bitmaps.h>
#include <base_units.h>
#include "project.h"
#include "panel_prev_model.h"
#include <class_board.h>
#include <class_drawpanel.h>
#include <pgm_base.h>

Go to the source code of this file.

Functions

static double rotationFromString (const wxString &aValue)
 rotationFromString Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION aRotation will be normalized between -MAX_ROTATION and MAX_ROTATION More...
 

Function Documentation

static double rotationFromString ( const wxString &  aValue)
static

rotationFromString Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION aRotation will be normalized between -MAX_ROTATION and MAX_ROTATION

Definition at line 119 of file panel_prev_model.cpp.

References DEGREES, DoubleValueFromString(), and MAX_ROTATION.

Referenced by PANEL_PREV_3D::updateOrientation().

120 {
121  double rotation = DoubleValueFromString( DEGREES, aValue ) / 10.0;
122 
123  if( rotation > MAX_ROTATION )
124  {
125  int n = rotation / MAX_ROTATION;
126  rotation -= MAX_ROTATION * n;
127  }
128  else if( rotation < -MAX_ROTATION )
129  {
130  int n = -rotation / MAX_ROTATION;
131  rotation += MAX_ROTATION * n;
132  }
133 
134  return rotation;
135 }
double DoubleValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils)
Function DoubleValueFromString converts aTextValue to a double.
Definition: base_units.cpp:302
#define MAX_ROTATION