Exemple #1
0
bool IACTropicalSystem::Draw(wxDC *dc, PlugIn_ViewPort *vp, TexFont &numfont, TexFont &sysfont) {
    bool hasDrawn = false;
    if (dc) {
        wxColour colour;
        GetGlobalColor(_T ( "YELO1" ), &colour);
        wxPen pen(colour, FRONT_WIDTH);
        dc->SetPen(pen);
        dc->SetBrush(*wxTRANSPARENT_BRUSH);
    } else {
        GetGlobalColor(_T ( "YELO1" ), &m_isoLineColor);
        m_isoLineWidth = wxMax(FRONT_WIDTH, GL_MIN_LINE_WIDTH);
    }
    hasDrawn = DrawPositions(dc, vp);
    if (dc) {
        if (m_positions.Count() > 0) {
            GeoPoint &Pos = m_positions[0];
            if (PointInLLBox(vp, Pos.x, Pos.y)) {
                wxPoint p;
                GetCanvasPixLL(vp, &p, Pos.y, Pos.x);
                wxColour colour;
                wxString msg1 = GetShortType(m_type);
                if (!msg1.IsEmpty()) {
                    hasDrawn = true;
                    GetGlobalColor(_T ( "SNDG1" ), &colour);
                    dc->SetTextForeground(colour);
                    wxFont sfont = dc->GetFont();

                    wxFont *font1 = wxTheFontList->FindOrCreateFont(SYSTEMS_FONT_SIZE, wxFONTFAMILY_ROMAN, wxNORMAL,
                                                                    wxFONTWEIGHT_BOLD, FALSE, wxString(_T ( "Arial" )));
                    dc->SetFont(*font1);
                    wxSize s1 = dc->GetTextExtent(msg1);
                    dc->DrawText(msg1, p.x - (s1.GetWidth() / 2), p.y - (s1.GetHeight() / 2));
                    dc->SetFont(sfont);
                }
            }
        }
    } else {
        if (m_positions.GetCount() > 0) {
            GeoPoint &Pos = m_positions[0];
            if (PointInLLBox(vp, Pos.x, Pos.y)) {
                wxPoint p;
                GetCanvasPixLL(vp, &p, Pos.y, Pos.x);
                wxColour colour;
                wxString msg1 = GetShortType(m_type);
                if (!msg1.IsEmpty()) {
                    hasDrawn = true;
                    glEnable(GL_BLEND);
                    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

                    wxPoint p;
                    GetCanvasPixLL(vp, &p, Pos.y, Pos.x);
                    int w, h;
                    sysfont.GetTextExtent(msg1, &w, &h);

                    int xd = p.x - (w / 2);
                    int yd = p.y - (h / 2);

                    GetGlobalColor(_T ( "SNDG1" ), &colour);
                    glColor3ub(colour.Red(), colour.Green(), colour.Blue());

                    glEnable(GL_TEXTURE_2D);
                    sysfont.RenderString(msg1, xd, yd);
                    glDisable(GL_TEXTURE_2D);
                    glDisable(GL_BLEND);
                }
            }
        }
    }

    return hasDrawn;
}
Exemple #2
0
bool IACSystem::Draw(wxDC *dc, PlugIn_ViewPort *vp, TexFont &numfont, TexFont &sysfont) {
    bool hasDrawn = false;
    if (dc) {
        if (m_positions.GetCount() == 1) {
            GeoPoint &Pos = m_positions[0];
            if (PointInLLBox(vp, Pos.x, Pos.y)) {
                wxPoint p;
                GetCanvasPixLL(vp, &p, Pos.y, Pos.x);
                wxColour colour;
                wxString msg1 = GetShortType(m_type);
                if (!msg1.IsEmpty()) {
                    hasDrawn = true;
                    GetGlobalColor(_T ( "UBLCK" ), &colour);
                    dc->SetTextForeground(colour);
                    wxFont sfont = dc->GetFont();

                    wxFont *font1 = wxTheFontList->FindOrCreateFont(SYSTEMS_FONT_SIZE, wxFONTFAMILY_ROMAN, wxNORMAL,
                                                                    wxFONTWEIGHT_BOLD, FALSE, wxString(_T ( "Arial" )));
                    dc->SetFont(*font1);
                    wxSize s1 = dc->GetTextExtent(msg1);
                    dc->DrawText(msg1, p.x - (s1.GetWidth() / 2), p.y - (s1.GetHeight() / 2));
                    wxFont *font2 = wxTheFontList->FindOrCreateFont(NUMBERS_FONT_SIZE, wxFONTFAMILY_SWISS, wxITALIC,
                                                                    wxFONTWEIGHT_NORMAL, FALSE, wxString(_T ( "Arial" )));
                    dc->SetFont(*font2);
                    wxString msg2 = GetValue();
                    if (!msg2.IsEmpty()) {
                        wxSize s2 = dc->GetTextExtent(msg2);
                        dc->DrawText(msg2, p.x - (s2.GetWidth() / 2), p.y + (s1.GetHeight() / 2) + (s2.GetHeight() / 2));

                        dc->SetFont(sfont);
                    }
                }
            }
        } else {
            wxColour colour;
            wxPen pen;
            pen = dc->GetPen();
            GetGlobalColor(_T ( "GREEN2" ), &colour);
            dc->SetPen(wxPen(colour, m_isoLineWidth));
            DrawPositions(dc, vp);
            dc->SetPen(pen);
        }
    } else {
        if (m_positions.GetCount() == 1) {
            GeoPoint &Pos = m_positions[0];
            if (PointInLLBox(vp, Pos.x, Pos.y)) {
                wxPoint p;
                GetCanvasPixLL(vp, &p, Pos.y, Pos.x);
                wxColour colour;
                wxString msg1 = GetShortType(m_type);
                if (!msg1.IsEmpty()) {
                    hasDrawn = true;
                    glEnable(GL_BLEND);
                    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

                    wxPoint p;
                    GetCanvasPixLL(vp, &p, Pos.y, Pos.x);
                    int w, h;
                    sysfont.GetTextExtent(msg1, &w, &h);

                    int xd = p.x - (w / 2);
                    int yd = p.y - (h / 2);

                    GetGlobalColor(_T ( "UBLCK" ), &colour);
                    glColor3ub(colour.Red(), colour.Green(), colour.Blue());

                    glEnable(GL_TEXTURE_2D);
                    sysfont.RenderString(msg1, xd, yd);
                    wxString msg2 = GetValue();
                    if (!msg2.IsEmpty()) {
                        int w1, h1;
                        numfont.GetTextExtent(msg2, &w1, &h1);
                        numfont.RenderString(msg2, p.x - (w1 / 2), p.y + (h / 2) + (h1 / 2));
                    }
                    glDisable(GL_TEXTURE_2D);
                    glDisable(GL_BLEND);
                }
            }
        } else {
            wxColour colour = m_isoLineColor;
            GetGlobalColor(_T ( "GREEN2" ), &m_isoLineColor);
            DrawPositions(dc, vp);
            m_isoLineColor = colour;
        }
    }
    return hasDrawn;
}
Exemple #3
0
    void VirtualMachine::LoadRuntimeClasses()
    {
        // Load only once.
        if(objectClass)
            return;

        // The first loaded module must be the runtime.
        runtimeModule = loadedModules[0];
        runtimeModule->SetRuntimeFlag(true);

        // Get basic classes.
        typeClass = GetClass(runtimeModule, "Chela.Lang.Type");
        objectClass = GetClass(runtimeModule, "Chela.Lang.Object");
        stringClass = GetClass(runtimeModule, "Chela.Lang.String");
        closureClass = GetClass(runtimeModule, "Chela.Lang.Closure");
        arrayClass = GetClass(runtimeModule, "Chela.Lang.Array");
        valueTypeClass = GetClass(runtimeModule, "Chela.Lang.ValueType");
        enumClass = GetClass(runtimeModule, "Chela.Lang.Enum");
        delegateClass = GetClass(runtimeModule, "Chela.Lang.Delegate");

        // Special attributes.
        threadStaticAttribute = GetClass(runtimeModule, "Chela.Lang.ThreadStaticAttribute");
        chelaIntrinsicAttribute = GetClass(runtimeModule, "Chela.Runtime.Core.ChelaIntrinsicAttribute");

        // Get the kernel data holding classes.
        streamHolderClass = GetTemplateClass(runtimeModule, "Chela.Compute.StreamHolder");
        streamHolder1DClass = GetTemplateClass(runtimeModule, "Chela.Compute.StreamHolder1D");
        streamHolder2DClass = GetTemplateClass(runtimeModule, "Chela.Compute.StreamHolder2D");
        streamHolder3DClass = GetTemplateClass(runtimeModule, "Chela.Compute.StreamHolder3D");
        uniformHolderClass = GetTemplateClass(runtimeModule, "Chela.Compute.UniformHolder");

        // Get the reflection classes.
        assemblyClass = GetClass(runtimeModule, "Chela.Reflection.Assembly");
        constructorInfoClass = GetClass(runtimeModule, "Chela.Reflection.ConstructorInfo");
        eventInfoClass = GetClass(runtimeModule, "Chela.Reflection.EventInfo");
        fieldInfoClass = GetClass(runtimeModule, "Chela.Reflection.FieldInfo");
        memberInfoClass = GetClass(runtimeModule, "Chela.Reflection.MemberInfo");
        methodInfoClass = GetClass(runtimeModule, "Chela.Reflection.MethodInfo");
        parameterInfoClass = GetClass(runtimeModule, "Chela.Reflection.ParameterInfo");
        propertyInfoClass = GetClass(runtimeModule, "Chela.Reflection.PropertyInfo");

        // Register associated types.
        RegisterPrimStruct(GetBoolType(), "Chela.Lang.Boolean");
        RegisterPrimStruct(GetCharType(), "Chela.Lang.Char");
        RegisterPrimStruct(GetSByteType(), "Chela.Lang.SByte");
        RegisterPrimStruct(GetByteType(), "Chela.Lang.Byte");
        RegisterPrimStruct(GetShortType(), "Chela.Lang.Int16");
        RegisterPrimStruct(GetUShortType(), "Chela.Lang.UInt16");
        RegisterPrimStruct(GetIntType(), "Chela.Lang.Int32");
        RegisterPrimStruct(GetUIntType(), "Chela.Lang.UInt32");
        RegisterPrimStruct(GetLongType(), "Chela.Lang.Int64");
        RegisterPrimStruct(GetULongType(), "Chela.Lang.UInt64");
        RegisterPrimStruct(GetSizeType(), "Chela.Lang.UIntPtr");
        RegisterPrimStruct(GetPtrDiffType(), "Chela.Lang.IntPtr");
        RegisterPrimStruct(GetFloatType(), "Chela.Lang.Single");
        RegisterPrimStruct(GetDoubleType(), "Chela.Lang.Double");
        RegisterPrimStruct(GetVoidType(), "Chela.Lang.Void");

        // Register vector associated types.
        RegisterPrimStruct(GetFloatVectorTy(this, 2), "Chela.Lang.Single2");
        RegisterPrimStruct(GetFloatVectorTy(this, 3), "Chela.Lang.Single3");
        RegisterPrimStruct(GetFloatVectorTy(this, 4), "Chela.Lang.Single4");
        RegisterPrimStruct(GetDoubleVectorTy(this, 2), "Chela.Lang.Double2");
        RegisterPrimStruct(GetDoubleVectorTy(this, 3), "Chela.Lang.Double3");
        RegisterPrimStruct(GetDoubleVectorTy(this, 4), "Chela.Lang.Double4");
        RegisterPrimStruct(GetIntVectorTy(this, 2), "Chela.Lang.Int32x2");
        RegisterPrimStruct(GetIntVectorTy(this, 3), "Chela.Lang.Int32x3");
        RegisterPrimStruct(GetIntVectorTy(this, 4), "Chela.Lang.Int32x4");
        RegisterPrimStruct(GetBoolVectorTy(this, 2), "Chela.Lang.Boolean2");
        RegisterPrimStruct(GetBoolVectorTy(this, 3), "Chela.Lang.Boolean3");
        RegisterPrimStruct(GetBoolVectorTy(this, 4), "Chela.Lang.Boolean4");

        // Register matrix associated types.
        RegisterPrimStruct(GetFloatMatrixTy(this, 3,3), "Chela.Lang.Single3x3");
        RegisterPrimStruct(GetFloatMatrixTy(this, 4,4), "Chela.Lang.Single4x4");

        // Declare them.
        typeClass->DeclarePass();
        objectClass->DeclarePass();
        stringClass->DeclarePass();
        closureClass->DeclarePass();
        arrayClass->DeclarePass();
        valueTypeClass->DeclarePass();
        enumClass->DeclarePass();
        delegateClass->DeclarePass();
        streamHolderClass->DeclarePass();
        streamHolder1DClass->DeclarePass();
        streamHolder2DClass->DeclarePass();
        streamHolder3DClass->DeclarePass();
        uniformHolderClass->DeclarePass();

        assemblyClass->DeclarePass();
        constructorInfoClass->DeclarePass();
        eventInfoClass->DeclarePass();
        fieldInfoClass->DeclarePass();
        memberInfoClass->DeclarePass();
        methodInfoClass->DeclarePass();
        parameterInfoClass->DeclarePass();
        propertyInfoClass->DeclarePass();
    }