Exemplo n.º 1
0
bool	ReadRoadBridge(const vector<string>& tokens, void * ref)
{
	BridgeInfo	info;

	if (TokenizeLine(tokens, " efffffffififfffffffi",
		&info.rep_type,
		&info.min_length, &info.max_length,
		&info.min_seg_length, &info.max_seg_length,
		&info.min_seg_count, &info.max_seg_count,
		&info.curve_limit,
		&info.split_count, &info.split_length, &info.split_arch,
		&info.min_start_agl, &info.max_start_agl,
		&info.search_dist,   &info.pref_start_agl,
		&info.min_center_agl, &info.max_center_agl,
		&info.height_ratio, &info.road_slope,
		&info.export_type) != 21) return false;

		// Special case these - otherwise we get inexact values from deg-rad conversion.
		 if (info.curve_limit == 90.0)		info.curve_limit = 0.0;
	else if (info.curve_limit ==180.0)		info.curve_limit =-1.0;
	else if (info.curve_limit ==  0.0)		info.curve_limit = 1.0;
	else									info.curve_limit = cos(info.curve_limit * DEG_TO_RAD);

	gBridgeInfo.push_back(info);
	return true;
}
Exemplo n.º 2
0
static void DoOptions( char *buf )
/********************************/
// process options in a string, if present
{
    char    opt[LINE_BUF_SIZE];
    char    *cmd;

    for( cmd = buf; *cmd != '\0'; ++cmd ) {
        if( *cmd == '/' ) {
            break;
        }
    }
    /* See if option separator was found. */
    if( *cmd == '/' ) {
        *cmd = '\0';
        strcpy( opt, cmd + 1 );
        /* Strip trailing spaces from text preceding the option. */
        --cmd;
        while( cmd > buf && *cmd == ' ' ) {
            *cmd-- = '\0';
        }
        /* Strip trailing junk from the option. */
        //@TODO!
        /* Now handle the option(s). */
        TokenizeLine( opt, '/', DoOneOption );
    }
}
Exemplo n.º 3
0
bool	ReadRoadPromoteZoning(const vector<string>& tokens, void * ref)
{
	gPromotedZoningSet.clear();
	if(TokenizeLine(tokens," S",&gPromotedZoningSet) != 2)
		return false;
	return true;
}
Exemplo n.º 4
0
bool	ReadLevelCrossing(const vector<string>& tokens, void * ref)
{
	int t1, t2;
	if(TokenizeLine(tokens," ee", &t1, &t2) != 3)
		return false;
	gLevelCrossings[t1] = t2;
	return true;
}
Exemplo n.º 5
0
bool	ReadRoadPromote(const vector<string>& tokens, void * ref)
{
	int	rt;
	ZoningPromote	p;
	if(TokenizeLine(tokens," eeee",&rt,&p.promote_left, &p.promote_right,&p.promote_both) != 5) return false;
	if(gZonePromote.count(rt) != 0)
		fprintf(stderr,"WARNING: promotion info for road %s included twice.\n", FetchTokenString(rt));
	gZonePromote[rt] = p;
	return true;
}
Exemplo n.º 6
0
bool	ReadChangeRule(const vector<string>& tokens, void * ref)
{
	ChangeRule r;
	if(TokenizeLine(tokens," eeee",
						&r.prev,
						&r.next,
						&r.new_mid) != 4)
	return false;
	gChangeRules.push_back(r);
	return true;
				
}
Exemplo n.º 7
0
bool	RoadGeneralProps(const vector<string>& tokens, void * ref)
{
	int				feature_type;
	NetFeatureInfo	info;
	if (TokenizeLine(tokens, " efie", &feature_type,
		&info.density_factor, &info.is_oneway, &info.oneway_feature) != 5) return false;


	if (gNetFeatures.count(feature_type) > 0)
		printf("WARNING: duplicate token %s\n", tokens[1].c_str());


	gNetFeatures[feature_type] = info;
	return true;
}
Exemplo n.º 8
0
bool ReadTwinRule(const vector<string>& tokens, void * ref)
{
	int type_1, type_2;
	if(TokenizeLine(tokens, " ee",&type_1,&type_2) != 3) return false;
	
	if(gTwinRules.count(type_1) || 
		gTwinRules.count(type_2))
	{
		printf("ERROR: duplicate twin rule.\n");
		return false;
	}
	gTwinRules[type_1] = type_2;
	gTwinRules[type_2] = type_1;
	return true;
}
Exemplo n.º 9
0
bool	ReadForkRule(const vector<string>& tokens, void * ref)
{
	ForkRule r;
	if(TokenizeLine(tokens," eeeeee",
						&r.trunk,
						&r.left,
						&r.right,
						&r.new_trunk,
						&r.new_left,
						&r.new_right) != 7)
	return false;
	gForkRules.push_back(r);
	return true;
				
}
Exemplo n.º 10
0
bool	ReadRoadPick(const vector<string>& tokens, void * ref)
{
	Feature2RepInfo	info;
	int				feature_type;

	if (TokenizeLine(tokens, " effffffffe", &info.feature, 
		&info.min_density,&info.max_density, 
		&info.min_rail, &info.max_rail,
		&info.rain_min,
		&info.rain_max,
		&info.temp_min,
		&info.temp_max,
		&info.rep_type) != 11)	return false;

	gFeature2Rep.push_back(info);
	return true;
}
Exemplo n.º 11
0
bool	ReadRoadSpecificProps(const vector<string>& tokens, void * ref)
{
	int rep_type;
	NetRepInfo	info;
	info.export_type_draped = NO_VALUE;	// hack for mesh tool - allow draped param to not be attached!

	float	crease, max_rad;

	if (TokenizeLine(tokens, " effffeiifff",&rep_type,
		&info.semi_l, &info.semi_r, &info.pad, &info.building_percent, &info.use_mode, &info.is_oneway, &info.export_type_draped, &crease, &max_rad, &info.max_err) != 12)
	{
		return false;
	}
	
	info.crease_angle_cos=cos(crease * DEG_TO_RAD);
	info.min_defl_deg_mtr = max_rad > 0.0 ? (360.0 / (2 * PI * max_rad)) : 0.0f;
	
	if (gNetReps.count(rep_type) > 0)
		printf("WARNING: duplicate token %s\n", FetchTokenString(rep_type));

	gNetReps[rep_type] = info;
	return true;
}
Exemplo n.º 12
0
void SourceEdit::OnConvertPaste(NMHDR* hdr, LRESULT* res)
{
  SCNXConvertPaste* cp = (SCNXConvertPaste*)hdr;
  *res = 0;

  // Get the source of the data
  COleDataObject data;
  if (cp->source)
    data.Attach((LPDATAOBJECT)(cp->source),FALSE);
  else
    data.AttachClipboard();

  // Try to interpret tables and leading white space
  if (data.IsDataAvailable(CF_UNICODETEXT))
  {
    CStringW theText(cp->utext,cp->ulen);
    CStringW newText, line;
    newText.Preallocate(theText.GetLength());

    bool foundTable = false;
    bool inTable = false;

    int charPos = 0, lineCount = 0;
    while (GetNextLine(theText,line,charPos))
    {
      if (inTable)
      {
        CArray<CStringW> tokens;
        TokenizeLine(line,tokens);

        // Separate multiple tokens with tabs: if less than two tokens,
        // we're at the end of the table
        if (tokens.GetSize() > 1)
        {
          line.Empty();
          for (int j = 0; j < tokens.GetSize(); j++)
          {
            if (j > 0)
              line.AppendChar(L'\t');
            line.Append(tokens.GetAt(j));
          }
        }
        else
          inTable = false;
      }
      else
      {
        // Look for the start of a table
        if (line.Left(6).CompareNoCase(L"table ") == 0)
        {
          inTable = true;
          foundTable = true;
        }

        // Replace any leading blocks of 4 spaces
        int i = 0;
        while (i >= 0)
        {
          if (line.Mid(i,4).Compare(L"    ") == 0)
          {
            line.Delete(i,3);
            line.SetAt(i,L'\t');
            i++;
          }
          else
            i = -1;
        }
      }

      if (lineCount > 0)
        newText.AppendChar(L'\n');
      newText.Append(line);
      lineCount++;
    }

    CString newTextUtf = TextFormat::UnicodeToUTF8(newText);
		cp->text = new char[newTextUtf.GetLength() + 1];
    strcpy(cp->text,newTextUtf);
    *res = 1;
  }
}
Exemplo n.º 13
0
extern void ParseMicrosoft( void )
/********************************/
// read in Microsoft linker commands
{
    char        cmd[LINE_BUF_SIZE];
    char        *end;
    size_t      len;
    bool        first;
    bool        more_objs;
    bool        more_libs;


    /* Start with object files. */
    mask_spc_chr = 0x1f;    /* Replace spaces with another character. */
    more_cmdline = !!*CmdFile->current;
    first = more_cmdline;
    is_new_line = true;
    do {
        more_objs = false;  /* No more unless we discover otherwise. */
        if( first )
            len = GetLine( cmd, sizeof( cmd ), OPTION_SLOT );
        else
            len = GetLine( cmd, sizeof( cmd ), OBJECT_SLOT );

        if( !len )
            break;
        end = LastStringChar( cmd );
        if( *end == mask_spc_chr ) {
            more_objs = true;
            *end = '\0';
        }
        TokenizeLine( cmd, mask_spc_chr, DoOneObject );
        first = false;
    } while( more_objs );

    /* Check for possible error conditions. */
    if( OverlayLevel )
        Error( "unmatched left parenthesis" );
    FindObjectName();   /* This will report an error if no objects. */

    mask_spc_chr = 0;   /* Remove spaces in input. */
    /* Get executable and map file name. */
    GetNextInput( cmd, sizeof( cmd ), RUN_SLOT );
    GetNextInput( cmd, sizeof( cmd ), MAP_SLOT );

    mask_spc_chr = 0x1f;    /* Replace spaces with another character. */
    /* Get library file names. */
    if( !is_term ) {
        do {
            GetLine( cmd, sizeof( cmd ), LIBRARY_SLOT );
            more_libs = false;
            if( is_term || *cmd == '\0' )
                break;
            end = LastStringChar( cmd );
            if( *end == mask_spc_chr ) {
                more_libs = true;
                *end = '\0';
            }
            TokenizeLine( cmd, mask_spc_chr, DoOneLib );
        } while( more_libs );
    }

    mask_spc_chr = 0;   /* Remove spaces in input again. */

    /* Get def file name and process it. */
    GetNextInput( cmd, sizeof( cmd ), DEF_SLOT );
    ProcessDefFile();
}