示例#1
0
text_symbolizer_helper::text_symbolizer_helper(
        shield_symbolizer const& sym,
        feature_impl const& feature,
        attributes const& vars,
        proj_transform const& prj_trans,
        unsigned width, unsigned height, double scale_factor,
        view_transform const& t, FaceManagerT & font_manager,
        DetectorT & detector, box2d<double> const& query_extent, agg::trans_affine const& affine_trans)
    : base_symbolizer_helper(sym, feature, vars, prj_trans, width, height, scale_factor, t, query_extent),
      finder_(feature, vars, detector, dims_, *placement_, font_manager, scale_factor),
      adapter_(finder_,true),
      converter_(query_extent_, adapter_, sym_, t, prj_trans, affine_trans, feature, vars, scale_factor)
{
   // setup vertex converter
    bool clip = mapnik::get<bool>(sym_, keys::clip, feature_, vars_, false);
    double simplify_tolerance = mapnik::get<double>(sym_, keys::simplify_tolerance, feature_, vars_, 0.0);
    double smooth = mapnik::get<double>(sym_, keys::smooth, feature_, vars_, 0.0);

    if (clip) converter_.template set<clip_line_tag>(); //optional clip (default: true)
    converter_.template set<transform_tag>(); //always transform
    converter_.template set<affine_transform_tag>();
    if (simplify_tolerance > 0.0) converter_.template set<simplify_tag>(); // optional simplify converter
    if (smooth > 0.0) converter_.template set<smooth_tag>(); // optional smooth converter
    if (geometries_to_process_.size())
    {
        init_marker();
        finder_.next_position();
    }
}
示例#2
0
void Replay::start(){
    load();

    index=0;
    b_replay=true;
    marker_publisher = ptr_node->advertise<visualization_msgs::Marker>("visualization_marker_replay", 10);
    init_marker();

    future = std::async(std::launch::async, std::bind(&Replay::update, this));


}
	//Only load BVH structure for distance checking
	SweptVolumeVisual::SweptVolumeVisual(std::string f, Geometry &in): TrisTriangleObject() {
		this->g = in;

		double scale = 1.0;
		this->g.setSX(scale);
		this->g.setSY(scale);
		this->g.setSZ(scale);
		this->tris_file_name=f;

		this->tris2marker( this->marker, tris_file_name.c_str() );
		set_color(ros::SWEPT_VOLUME);
		init_marker();
	}
示例#4
0
	ColladaObject::ColladaObject(const char *cfilename): RVIZVisualMarker(){
		filename = std::string(cfilename);

		this->g.setX(0);
		this->g.setY(0);
		this->g.setSX(1.0);
		this->g.setSY(1.0);
		this->g.setSZ(1.0);
		set_color(0,0,0,0);//texture is not shown, if any color!=0

		init_marker();
		marker.mesh_resource = filename;
		marker.mesh_use_embedded_materials=true;
	}
示例#5
0
	void PrimitiveMarkerTriangle::initPrimitiveMarker( PrimitiveMarkerTriangle *pmt){

		std::pair< std::vector<fcl::Vec3f>, std::vector<fcl::Triangle> > vt = pmt->getVerticesAndTriangles();

#ifdef FCL_COLLISION_CHECKING
		this->bvh = new fcl::BVHModel< BoundingVolume >();
		primitiveMarker2BVH(this->bvh, vt);
#endif
		this->pqp_model = new PQP_Model;

		primitiveMarker2PQP(this->pqp_model, vt);
		primitiveMarker2RVIZMarker(this->marker, vt);

		init_marker();
	}
示例#6
0
text_symbolizer_helper::text_symbolizer_helper(
        shield_symbolizer const& sym,
        feature_impl const& feature,
        attributes const& vars,
        proj_transform const& prj_trans,
        unsigned width, unsigned height, double scale_factor,
        CoordTransform const& t, FaceManagerT & font_manager,
        DetectorT &detector, const box2d<double> &query_extent)
    : base_symbolizer_helper(sym, feature, vars, prj_trans, width, height, scale_factor, t, query_extent),
      finder_(feature, vars, detector, dims_, *placement_, font_manager, scale_factor),
      points_on_line_(true)
{
    if (geometries_to_process_.size())
    {
        init_marker();
        finder_.next_position();
    }
}
	SweptVolumeObject::SweptVolumeObject(std::string f, Geometry &in): TrisTriangleObject() {
		this->g = in;

		double scale = 1.0;
		this->g.setSX(scale);
		this->g.setSY(scale);
		this->g.setSZ(scale);
		this->tris_file_name=f;
		//this->bvh = new fcl::BVHModel< BoundingVolume >();
		//this->tris2BVH(this->bvh, tris_file_name.c_str() );

		this->pqp_model = new PQP_Model;
		this->tris2PQP( this->pqp_model, tris_file_name.c_str() );

		//this->tris2marker( this->marker, tris_file_name.c_str() );
		set_color(ros::SWEPT_VOLUME);
		init_marker();
	}
示例#8
0
	BlenderMeshTriangleObject::BlenderMeshTriangleObject(const char *cfilename, const char *trisname, double x, double y, double tz): TrisTriangleObject(){
		filename = std::string(cfilename);

		tris_file_name = get_tris_str(trisname);

		this->g.setX(x);
		this->g.setY(y);
		this->g.setSX(1.0);
		this->g.setSY(1.0);
		this->g.setSZ(1.0);

		this->pqp_model = new PQP_Model;
		this->pqp_margin = new PQP_Model;
		this->tris2PQP( this->pqp_model, this->pqp_margin, tris_file_name.c_str() );

		set_color(0,0,0,0);
		init_marker();
		marker.mesh_resource = filename;
		marker.mesh_use_embedded_materials=true;
	}
	void TrisTriangleObject::init_object( std::string f, Geometry &in, bool mirror_y){
		this->g = in;

		double scale = 1.0;
		this->g.setSX(scale);
		this->g.setSY(scale);
		this->g.setSZ(scale);
		this->tris_file_name=f;

		this->pqp_model = new PQP_Model;
		this->pqp_margin = new PQP_Model;
		this->tris2PQP( this->pqp_model, this->pqp_margin, tris_file_name.c_str(), mirror_y);
#ifdef FCL_COLLISION_CHECKING
		this->bvh = new fcl::BVHModel< BoundingVolume >();
		this->tris2BVH(this->bvh, tris_file_name.c_str(), mirror_y);
#endif
		this->tris2marker( this->marker, tris_file_name.c_str(), mirror_y);
		set_color(ros::OBSTACLE);
		init_marker();

	}
示例#10
0
text_symbolizer_helper::text_symbolizer_helper(
        shield_symbolizer const& sym,
        feature_impl const& feature,
        attributes const& vars,
        proj_transform const& prj_trans,
        unsigned width, unsigned height, double scale_factor,
        view_transform const& t, FaceManagerT & font_manager,
        DetectorT & detector, box2d<double> const& query_extent, agg::trans_affine const& affine_trans)
    : base_symbolizer_helper(sym, feature, vars, prj_trans, width, height, scale_factor, t, query_extent),
      finder_(feature, vars, detector, dims_, *info_ptr_, font_manager, scale_factor),
      adapter_(finder_,true),
      converter_(query_extent_, adapter_, sym_, t, prj_trans, affine_trans, feature, vars, scale_factor)
{
    //WI: Porting the change to allow shield symbolizers to be placed along line
    // direction 13NOV2014
    label_placement_enum how_placed = text_props_->label_placement;
    if (how_placed == LINE_PLACEMENT)
    {
        //WI: this flag distinguish between placing shields at the center of a point
        //placement on the line or along the line direction
        //Setting it to false here, to force shield placement along line direction
        adapter_.points_on_line_ = false;
    }
   // setup vertex converter
    value_bool clip = mapnik::get<value_bool, keys::clip>(sym_, feature_, vars_);
    value_double simplify_tolerance = mapnik::get<value_double, keys::simplify_tolerance>(sym_, feature_, vars_);
    value_double smooth = mapnik::get<value_double, keys::smooth>(sym_, feature_, vars_);

    if (clip) converter_.template set<clip_line_tag>(); //optional clip (default: true)
    converter_.template set<transform_tag>(); //always transform
    converter_.template set<affine_transform_tag>();
    if (simplify_tolerance > 0.0) converter_.template set<simplify_tag>(); // optional simplify converter
    if (smooth > 0.0) converter_.template set<smooth_tag>(); // optional smooth converter
    if (geometries_to_process_.size())
    {
        init_marker();
        finder_.next_position();
    }
}
int main(int argc, char **argv) {
  int fin, res, id=0;
  off_t block_end, block_start, upto;
  id_info_t id_info;
  char *filename = NULL;
  char *type = NULL;
  int optindex=0;
  bz_info_t bfile;
  int verbose = 0;
  int optc;
  int result;

  struct option optvalues[] = {
    {"filename", 1, 0, 'f'},
    {"type", 1, 0, 't'},
    {"verbose", 0, 0, 'v'},
    {"version", 0, 0, 'V'},
    {NULL, 0, NULL, 0}
  };

  while (1) {
    optc = getopt_long_only(argc,argv,"f:hvV", optvalues, &optindex);
    if (optc=='f') {
     filename=optarg;
    }
    else if (optc == 't') {
     type = optarg;
    }
    else if (optc == 'h')
      usage(NULL);
    else if (optc == 'v')
      verbose++;
    else if (optc == 'V')
      show_version(VERSION);
    else if (optc == -1) break;
    else usage("Unknown option or other error\n");
  }

  if (! filename) {
    usage(NULL);
  }

  fin = open (filename, O_RDONLY);
  if (fin < 0) {
    fprintf(stderr,"Failed to open file %s for read\n", filename);
    exit(1);
  }

  bfile.file_size = get_file_size(fin);
  bfile.footer = init_footer();
  bfile.marker = init_marker();
  result = check_file_for_footer(fin, &bfile);
  if (result == -1) {
    bfile.position = bfile.file_size;
  }
  else {
    bfile.position = bfile.file_size - (off_t)11; /* size of footer, perhaps with 1 byte extra */
  }
  bfile.position -=(off_t)6; /* size of marker */
  bfile.initialized = 0;
  bfile.bytes_read = 0;

  /* start at end of file */
  block_end = bfile.position;
  upto = block_end;

  block_start = (off_t)-1;
  id = 0;

  while (!id) {
    bfile.initialized = 0;
    init_decompress(&bfile);

    block_start = find_first_bz2_block_from_offset(&bfile, fin, block_end, BACKWARD);

    if (block_start <= (off_t) 0) giveup(fin);
    BZ2_bzDecompressEnd (&(bfile.strm));

    res = get_last_id_after_offset(fin, &id_info, &bfile, upto, type, verbose);
    if (res > 0) {
      id = id_info.id;
    }
    else {
      upto = block_end;
      block_end = block_start - (off_t) 1;
      if (block_end <= (off_t) 0) giveup(fin);
    }
    BZ2_bzDecompressEnd (&(bfile.strm));
  }
  if (!id) giveup(fin);

  fprintf(stdout, "%s_id:%d\n", type, id);
  close(fin);
  exit(0);
}