KiCad PCB EDA Suite
panel_prev_model.cpp File Reference
#include "panel_prev_model.h"
#include <3d_canvas/eda_3d_canvas.h>
#include <common_ogl/cogl_att_list.h>
#include <class_board.h>
#include <base_units.h>
#include <bitmaps.h>
#include <dpi_scaling.h>
#include <pgm_base.h>
#include <project.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

◆ rotationFromString()

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 132 of file panel_prev_model.cpp.

133 {
134  double rotation = DoubleValueFromString( DEGREES, aValue ) / 10.0;
135 
136  if( rotation > MAX_ROTATION )
137  {
138  int n = rotation / MAX_ROTATION;
139  rotation -= MAX_ROTATION * n;
140  }
141  else if( rotation < -MAX_ROTATION )
142  {
143  int n = -rotation / MAX_ROTATION;
144  rotation += MAX_ROTATION * n;
145  }
146 
147  return rotation;
148 }
double DoubleValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils)
Function DoubleValueFromString converts aTextValue to a double.
Definition: base_units.cpp:314
#define MAX_ROTATION

References DEGREES, DoubleValueFromString(), and MAX_ROTATION.

Referenced by PANEL_PREV_3D::updateOrientation().