Boost logo

Boost Users :

Subject: Re: [Boost-users] [Geometry] Compilation errors after moving to 1.55b1
From: Szymon Gatner (szymon.gatner_at_[hidden])
Date: 2013-10-29 14:10:10


Visual Studio 2012 Update 3, Windows 7.

Full contents of cpp file:

#include "pch.h"
#include "area_outline_node.hpp"
#include <lgs/foreach.hpp>
#include "hex.hpp"
#include <lgs/renderer.hpp>
#include "faction.hpp"
#include "alliance.hpp"

#include "neighbor_graph.hpp"
#include <lgs/graph/bfs_search.hpp>
#include <lgs/opengl/geometry.hpp>
#include "hex_functions.hpp"

#include <lgs/opengl/opengl.hpp>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/adapted/c_array.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/register/point.hpp>

using namespace boost::geometry;

BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(Vec2i, int, cs::cartesian, x, y,
setX, setY);

namespace
{
  int points[][2] = {{16, 0}, {60,0}, {76,32}, {60, 64}, {16, 64}, {0, 32}};

  typedef Vec2i Point;
  typedef model::polygon<Point, false> Poly;
  typedef strategy::transform::translate_transformer<Point, Point>
Translate; <<<< error here

  Poly hexPoly;

  struct FactionBorderHex
  {
    FactionBorderHex(Faction& faction) : faction_(&faction) {}

    bool operator()(const Hex* hex) const
    {
      return hex->faction() == faction_ && IsFactionBorderHex()(hex);
    }

    Faction* faction_;
  };
}

AreaOutlineNode::AreaOutlineNode()
{
  if (hexPoly.outer().empty())
  {
    append(hexPoly, points);
    correct(hexPoly);
  }
}

void AreaOutlineNode::setFaction(Faction* faction)
{
  if (faction_ != faction)
  {
    faction_ = faction;
    meshes_.clear();

    if (faction_)
    {
      setArea(faction_->hexes());
    }
  }
}

void AreaOutlineNode::setArea(const Lgs::Vector<Hex*>& area)
{
  boost::unordered_set<Hex*> factionBorder = faction_->getBorder();

  std::vector<Vec2f> verts;

  while (!factionBorder.empty())
  {
    Lgs::Vector<Hex*> border = floodFill(*factionBorder.begin(),
HexNeighborGraph(), FactionBorderHex(*faction_));

    Poly polySum;

    foreach (Hex* hex, border)
    {
      factionBorder.erase(hex);

      Vec2i pos = pixelPosition(*hex);
      Poly poly;

      transform(hexPoly, poly, Translate(pos.x(), pos.y()));

      std::vector<Poly> multiSum;
      union_(polySum, poly, multiSum);

      polySum = multiSum.front();
    }

    verts.assign(polySum.outer().begin(), polySum.outer().end());
    meshes_.emplace_back(new Lgs::Geometry(Lgs::GeometryType::LineStrip));
    meshes_.back()->setVertices(&verts.front(), verts.size());
    meshes_.back()->setColors(&faction_->alliance()->borderColor(), 1);
  }
}

void AreaOutlineNode::doRender(Renderer& r, const Recti& cullRect) const
{
  if (faction_)
  {

    foreach (const boost::shared_ptr<Lgs::Geometry>& mesh, meshes_)
    {
      //r.drawMesh(mesh);
      mesh->draw();
    }
  }
}

Sizei AreaOutlineNode::size() const
{
  //FIXME: proper size based on envelope()
  return Sizei(10000, 10000);
}

2013/10/29 Mateusz Loskot <mateusz_at_[hidden]>

> On 29 October 2013 15:10, Szymon Gatner <szymon.gatner_at_[hidden]> wrote:
> > Moving to 1.55b1 from 1.54 gives:
> >
> > Error 1 error C2976:
> > 'boost::geometry::strategy::transform::translate_transformer' : too few
> > template arguments
> >
> > offending line is:
> >
> > typedef strategy::transform::translate_transformer<Point, Point>
> Translate;
>
> Compilation of what test case/example of Boost.Geometry
> using what compiler causes this error?
>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Szymon Gatner
The Lordz Games Studio
www.thelordzgamesstudio.com
Twitter: @sgatner


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net