Beispiel #1
0
const bool AreaLight::Write(std::ostream &stream) const
{
    if( !WriteHeader( stream, "AreaLight" ) )
        return false;

    Indent();
    {
        // Write the base
        if( !Light::Write( stream ) )
            return false;

        if( !WriteVariable( stream, "vertex1", _v1 )                                ||
            !WriteVariable( stream, "vertex2", _v2 )                                ||
            !WriteVariable( stream, "vertex3", _v3 )                                ||
            !WriteVariable( stream, "numHorizontalSamples", _numHorizontalSamples ) ||
            !WriteVariable( stream, "numVerticalSamples", _numVerticalSamples )     )
            return false;
    }
    Unindent();

    if( !WriteFooter( stream, "AreaLight" ) )
        return false;

    return true;
}
Beispiel #2
0
// GenerateVCXProj
//------------------------------------------------------------------------------
const AString & SLNGenerator::GenerateSLN(  const AString & solutionFile,
        const AString & solutionBuildProject,
        const AString & solutionVisualStudioVersion,
        const AString & solutionMinimumVisualStudioVersion,
        const Array< VSProjectConfig > & configs,
        const Array< VCXProjectNode * > & projects,
        const Array< SLNDependency > & slnDeps,
        const Array< SLNSolutionFolder > & folders )
{
    // preallocate to avoid re-allocations
    m_Output.SetReserved( MEGABYTE );
    m_Output.SetLength( 0 );

    // determine folder for project
    const char * lastSlash = solutionFile.FindLast( NATIVE_SLASH );
    AStackString<> solutionBasePath( solutionFile.Get(), lastSlash ? lastSlash + 1 : solutionFile.Get() );

    AStackString<> solutionBuildProjectGuid;
    Array< AString > projectGuids( projects.GetSize(), false );
    Array< AString > solutionProjectsToFolder( projects.GetSize(), true );
    Array< AString > solutionFolderPaths( folders.GetSize(), true );

    // Create solution configs (solves Visual Studio weirdness)
    const size_t configCount = configs.GetSize();
    Array< SolutionConfig > solutionConfigs( configCount, false );
    solutionConfigs.SetSize( configCount );
    for ( size_t i = 0 ; i < configCount ;  ++i )
    {
        const VSProjectConfig & projectConfig = configs[ i ];
        SolutionConfig & solutionConfig = solutionConfigs[ i ];

        solutionConfig.m_Config = projectConfig.m_Config;
        solutionConfig.m_Platform = projectConfig.m_Platform;

        if ( projectConfig.m_Platform.MatchesI( "Win32" ) )
        {
            solutionConfig.m_SolutionPlatform = "x86";
        }
        else
        {
            solutionConfig.m_SolutionPlatform = projectConfig.m_Platform;
        }
    }

    // Sort again with substituted solution platforms
    solutionConfigs.Sort();

    // construct sln file
    WriteHeader( solutionVisualStudioVersion, solutionMinimumVisualStudioVersion );
    WriteProjectListings( solutionBasePath, solutionBuildProject, projects, folders, slnDeps, solutionBuildProjectGuid, projectGuids, solutionProjectsToFolder );
    WriteSolutionFolderListings( folders, solutionFolderPaths );
    Write( "Global\r\n" );
    WriteSolutionConfigurationPlatforms( solutionConfigs );
    WriteProjectConfigurationPlatforms( solutionBuildProjectGuid, solutionConfigs, projectGuids );
    WriteNestedProjects( solutionProjectsToFolder, solutionFolderPaths );
    WriteFooter();

    return m_Output;
}
Beispiel #3
0
void DotGraph::Generate(Object root, String const &filename)
{
	this->Clear();
	WriteHeader();
	*this << root;
	WriteFooter();
	WriteToFile(filename.c_str());
}
bool MapPainterSVG::DrawMap(const Projection& projection,
                            const MapParameter& parameter,
                            const MapData& data,
                            std::ostream& stream)
{
    this->stream.rdbuf(stream.rdbuf());
    typeConfig=styleConfig->GetTypeConfig();

    WriteHeader(projection.GetWidth(),projection.GetHeight());

    Draw(projection,
         parameter,
         data);

    WriteFooter();

    fillStyleNameMap.clear();
    lineStyleNameMap.clear();

    return true;
}
Beispiel #5
0
 ~SessionPlain() {
   WriteFooter();
 }
Beispiel #6
0
void StepFileWriter::ExportSurfacesTo(char *file) {
    Group *g = SK.GetGroup(SS.GW.activeGroup);
    SShell *shell = &(g->runningShell);

    if(shell->surface.n == 0) {
        Error("The model does not contain any surfaces to export.%s",
            g->runningMesh.l.n > 0 ?
                "\n\nThe model does contain triangles from a mesh, but "
                "a triangle mesh cannot be exported as a STEP file. Try "
                "File -> Export Mesh... instead." : "");
        return;
    }

    f = fopen(file, "wb");
    if(!f) {
        Error("Couldn't write to '%s'", file);
        return;
    }

    WriteHeader();
	WriteProductHeader();

    ZERO(&advancedFaces);

    SSurface *ss;
    for(ss = shell->surface.First(); ss; ss = shell->surface.NextAfter(ss)) {
        if(ss->trim.n == 0) continue;

        // Get all of the loops of Beziers that trim our surface (with each
        // Bezier split so that we use the section as t goes from 0 to 1), and
        // the piecewise linearization of those loops in xyz space.
        SBezierList sbl;
        ZERO(&sbl);
        ss->MakeSectionEdgesInto(shell, NULL, &sbl);

        // Apply the export scale factor.
        ss->ScaleSelfBy(1.0/SS.exportScale);
        sbl.ScaleSelfBy(1.0/SS.exportScale);

        ExportSurface(ss, &sbl);

        sbl.Clear();
    }

    fprintf(f, "#%d=CLOSED_SHELL('',(", id);
    int *af;
    for(af = advancedFaces.First(); af; af = advancedFaces.NextAfter(af)) {
        fprintf(f, "#%d", *af);
        if(advancedFaces.NextAfter(af) != NULL) fprintf(f, ",");
    }
    fprintf(f, "));\n");
    fprintf(f, "#%d=MANIFOLD_SOLID_BREP('brep',#%d);\n", id+1, id);
    fprintf(f, "#%d=ADVANCED_BREP_SHAPE_REPRESENTATION('',(#%d,#170),#168);\n",
        id+2, id+1);
    fprintf(f, "#%d=SHAPE_REPRESENTATION_RELATIONSHIP($,$,#169,#%d);\n",
        id+3, id+2);

    WriteFooter();

    fclose(f);
    advancedFaces.Clear();
}