Exemplo n.º 1
0
 boost::optional<ModelObject> SpaceLoad_Impl::spaceTypeAsModelObject() const {
   OptionalModelObject result;
   OptionalSpaceType intermediate = spaceType();
   if (intermediate) {
     result = *intermediate;
   }
   return result;
 }
Exemplo n.º 2
0
void print_directions(char** maze, int w, int h){
	//find the start of the maze
	int i = 0;
	int j = 0;
	while(maze[0][i] != ' ')
	{
		i++;
	}
	printf("the entrance is location (0, %d\n", i);
	//move south until an intersection
	int a = 0;
	int b = i;
	int type = HALLWAY;
	while(type == HALLWAY){
		appendLocation(&a, &b, SOUTH);
		type = spaceType(a, b, SOUTH, maze, w, h);
		j++;
	}
	printDir(SOUTH, j);
	atIntersection(a, b, SOUTH, maze, w, h);
}
Exemplo n.º 3
0
//moves in direction d
void moveDirection(int x, int y, int d, char ** maze, int w, int h){
	int type = HALLWAY;//holds the type of the current point (HALLWAY to start the loop)
	int i = 0; 
	int a = x;
	int b = y;
	while(type == HALLWAY){
		appendLocation(&a, &b, d);
		type = spaceType(a, b, d, maze, w, h);
		i++;
	}
	//print direction
	int opposite;
	opposite = printDir(d, i);

	//if the type is an intersection
	if (type == INTERSECTION)
	{
		atIntersection(a, b, d, maze, w, h);
	}

	//print opposite direction to return to previous intersection
	d = printDir(opposite, i);
}
OptionalModelObject ReverseTranslator::translateZoneList( const WorkspaceObject & workspaceObject )
{
   if( workspaceObject.iddObject().type() != IddObjectType::Zone ){
    LOG(Error, "WorkspaceObject is not IddObjectType: Zone");
    return boost::none;
  }

  openstudio::model::SpaceType spaceType( m_model );

  OptionalString s = workspaceObject.name();
  if(s){
    spaceType.setName(*s);
  }

  for (const IdfExtensibleGroup& idfGroup : workspaceObject.extensibleGroups()){
    WorkspaceExtensibleGroup workspaceGroup = idfGroup.cast<WorkspaceExtensibleGroup>();
    
    OptionalWorkspaceObject target = workspaceGroup.getTarget(0);
    if (target){
      OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
      if (modelObject){
        if (modelObject->optionalCast<Space>()){
          Space space = modelObject->cast<Space>();

          if (space.spaceType()){
            LOG(Warn, "Overriding previously assigned SpaceType for Space '" << space.name().get() << "'");
          }

          space.setSpaceType(spaceType);

        }
      }
    }
  }

  return spaceType;
}