void NET_SerialTrackingServant::
nGetRADecTargetDetails(CORBA::Double& ra_rad, CORBA::Double& dec_rad,
		       CORBA::Double& epoch, 
		       CORBA::Double& offset_time_sidereal_min, 
		       CORBA::Double& wobble_offset_rad, 
		       CORBA::Double& wobble_direction_rad,
		       CORBA::String_out name, 
		       CORBA::Boolean& use_convergent_pointing)
{
  RegisterThisFunction fnguard(__PRETTY_FUNCTION__);
  TelescopeController::StateElements tse = m_controller->tse();

  TargetObject* object = m_controller->getTargetObject();
  if(!object)throw WrongTargetType();

  use_convergent_pointing = false;
#if 0
  const ConvergentPointinglObject* convergent 
    = dynamic_cast<const ConvergentPointinglObject*>(object);
  if(convergent)
    {
      use_convergent_pointing = true;
      TargetObject* sub_object = convergent->getTargetObject();
      delete object;
      object = sub_object;
      if(!object)throw WrongTargetType();
    }

#endif

  const RaDecObject* radec = dynamic_cast<const RaDecObject*>(object);
  if(radec)
    {
      ra_rad                   = radec->coords().longitudeRad();
      dec_rad                  = radec->coords().latitudeRad();
      epoch                    = radec->epoch();

      const CoordinateOffset* off = radec->offset();

      const OnOffOffset* onoff = dynamic_cast<const OnOffOffset*>(off);
      if(onoff)
	{
	  offset_time_sidereal_min = onoff->getOffsetTime().hrsPM()*60;
	}

      const WobbleOffset* wobble = dynamic_cast<const WobbleOffset*>(off);
      if(wobble)
	{
	  Angle phi = Angle::frDeg(180) - wobble->getWobbleCoords().phiRad();
	  wobble_offset_rad    = wobble->getWobbleCoords().thetaRad();
	  wobble_direction_rad = phi.rad();
	}

      name                     = CORBA::string_dup(radec->name().c_str());
      delete object;
      return;
    };

  delete object;
  throw WrongTargetType();
  return;
}
Beispiel #2
0
float	Math::acos(const Angle &v)
{
  return (::acos(v.rad()));
}
Beispiel #3
0
float	Math::atan(const Angle &v)
{
  return (::atan(v.rad()));
}
void StreetRenderer::drawSegment(QPainter& painter,
				 A2O::Segment::Ptr segment,
				 const PanelTransformation& panelTransform)
{
  Pose2D beginPose = segment->getBeginLink()->getPose();
  Pose2D endPose = Geometry::calculateArcPose(segment->getLength(), segment->getBendingAngle());
  Angle bendingAngle = segment->getBendingAngle();
  bool straightSegment = segment->getBendingAngle().rad() == 0;
  double radius = 0;
  
  // Set the current painting system to the begin of the segment
  panelTransform.setTransform(beginPose, painter);
  
  QPointF begin(0, 0);
  QPointF end(endPose.getPosition()(0), endPose.getPosition()(1));

  // Draw segment background
  if (straightSegment) {
    // Draw street background
    if (segment->consumesDriveInstruction()) {
      painter.setPen(_instructionStreetPen);
    } else {
      painter.setPen(_streetPen);
    }
    painter.drawLine(begin, end);
  } else {
    radius = double(segment->getLength() / bendingAngle.rad());
    // Draw street background
    if (segment->consumesDriveInstruction()) {
      painter.setPen(_instructionStreetPen);
    } else {
      painter.setPen(_streetPen);
    }
    RenderUtil::drawArc(painter, begin, radius, bendingAngle.rad());
    painter.setPen(_thinStreetPen);
    RenderUtil::drawArc(painter, QPointF(0, -0.465), radius + 0.465, bendingAngle.rad());
    RenderUtil::drawArc(painter, QPointF(0, 0.465), radius - 0.465, bendingAngle.rad());
  }
  

  // Draw Signs belonging to segment 
  std::vector<RoadSign::Ptr> signs = segment->getRoadSigns();
  for(unsigned int i=0; i < signs.size(); i++) {
    RoadSign::Ptr sign = signs[i];
    
    std::stringstream fileName;
    fileName << ":/res/" << sign->getName() << ".png";
    std::string file = fileName.str();
    QImage image(file.c_str());

    Angle signAngle = sign->getPose().getAngle();
    signAngle -= Angle::deg(90);
    image = image.transformed(QTransform().rotate(signAngle.deg()));
    image = image.mirrored(false, true);


    QRectF rect(0.0, -0.25, 0.5, 0.5);
    
    painter.drawImage(rect, image);
  }

  // Draw begin link and sub segments
  drawSubSegments(painter, segment, panelTransform);
  panelTransform.setTransform(beginPose, painter);
  
  // Draw segment lines
  if (straightSegment) {
    // Draw segment lines
    painter.setPen(_streetLinePen);
    if (segment->isXCrossing()) {
      painter.drawLine(QPointF(0, 0.465), QPointF(0.035, 0.5));
      painter.drawLine(QPointF(0, -0.465), QPointF(0.035, -0.5));
      painter.drawLine(QPointF(1, 0.465), QPointF(0.965, 0.5));
      painter.drawLine(QPointF(1, -0.465), QPointF(0.965, -0.5));
    } else if(segment->isTCrossingLS()) {
      painter.drawLine(QPointF(0, 0.465), QPointF(0.035, 0.5));
      painter.drawLine(QPointF(1, 0.465), QPointF(0.965, 0.5));
      painter.drawLine(QPointF(0, -0.465), QPointF(1, -0.465));
    } else if(segment->isTCrossingLR()) {
      painter.drawLine(QPointF(0, 0.465), QPointF(0.035, 0.5));
      painter.drawLine(QPointF(0, -0.465), QPointF(0.035, -0.5));
      painter.drawLine(QPointF(0.965, 0.5), QPointF(0.965, -0.5));
    } else if(segment->isTCrossingSR()) {
      painter.drawLine(QPointF(0, 0.465), QPointF(1, 0.465));
      painter.drawLine(QPointF(0, -0.465), QPointF(0.035, -0.5));
      painter.drawLine(QPointF(1, -0.465), QPointF(0.965, -0.5));
    } else {
      painter.drawLine(QPointF(0, 0.465), QPointF(segment->getLength(), 0.465));
      painter.drawLine(QPointF(0, -0.465), QPointF(segment->getLength(), -0.465));
    
      // Draw middle line
      painter.setPen(_middleLinePen);
      painter.drawLine(begin, end);
    }
  } else {
    // Draw left and right line
    painter.setPen(_streetLinePen);
    if (radius > 0) {
      RenderUtil::drawArc(painter, QPointF(0, -0.465), radius + 0.465, bendingAngle.rad());
      RenderUtil::drawArc(painter, QPointF(0, 0.465), radius - 0.465, bendingAngle.rad(), _helperLinePen);
    } else {
      RenderUtil::drawArc(painter, QPointF(0, -0.465), radius + 0.465, bendingAngle.rad(), _helperLinePen);
      RenderUtil::drawArc(painter, QPointF(0, 0.465), radius - 0.465, bendingAngle.rad());
    }
    
    // Draw middle line
    painter.setPen(_middleLinePen);
    RenderUtil::drawArc(painter, begin, radius, bendingAngle.rad());
  }
}
Beispiel #5
0
bool operator==(const Angle &lhs, const Angle &rhs) {return fcmp(lhs.rad(), rhs.rad()) == 0;}
Beispiel #6
0
bool operator<(const Angle &lhs, const Angle &rhs) {return fcmp(lhs.rad(), rhs.rad()) < 0;}
Beispiel #7
0
Angle operator-(const Angle &angle) noexcept {return Radians{-angle.rad()};}
Beispiel #8
0
long double operator/(const Angle &lhs, const Angle &rhs) noexcept {return lhs.rad() / rhs.rad();}