Пример #1
0
 GClock(){
     setBounds((800 - 212) / 2, (600 - 50) / 2, 212, 50);
     setTitle("とけい");
     refreshDate();
     label = new Label(time, Label::CENTER);
     label->setBounds(0, 4, 200, 16);
     add(label);
     setTimer(1000);
 }
Пример #2
0
double RateGammaInvar::optimizeParameters(double gradient_epsilon) {

	int ndim = getNDim();

	// return if nothing to be optimized
	if (ndim == 0)
		return phylo_tree->computeLikelihood();

    if (verbose_mode >= VB_MED)
        cout << "Optimizing " << name << " model parameters by " << optimize_alg << " algorithm..." << endl;

	if (optimize_alg.find("EM_RR") != string::npos) {
        return randomRestartOptimization(gradient_epsilon);
    } else if (optimize_alg.find("Brent") != string::npos || phylo_tree->aln->frac_const_sites == 0.0 || isFixPInvar() || isFixGammaShape()) {
		double lh = phylo_tree->computeLikelihood();
		cur_optimize = 0;
		double gamma_lh = RateGamma::optimizeParameters(gradient_epsilon);
		ASSERT(gamma_lh >= lh-0.1);
		cur_optimize = 1;
		double invar_lh = -DBL_MAX;
        invar_lh = RateInvar::optimizeParameters(gradient_epsilon);
		ASSERT(invar_lh >= gamma_lh-0.1);
        cur_optimize = 0;
        return invar_lh;
	} else if (optimize_alg.find("EM") != string::npos) {
        return optimizeWithEM(gradient_epsilon);
    } else if (optimize_alg.find("BFGS") != string::npos) {
        //if (freq_type == FREQ_ESTIMATE) scaleStateFreq(false);
        double *variables = new double[ndim+1];
        double *upper_bound = new double[ndim+1];
        double *lower_bound = new double[ndim+1];
        bool *bound_check = new bool[ndim+1];
        double score;

        // by BFGS algorithm
        setVariables(variables);
        setBounds(lower_bound, upper_bound, bound_check);

        score = -minimizeMultiDimen(variables, ndim, lower_bound, upper_bound, bound_check, max(gradient_epsilon, TOL_GAMMA_SHAPE));

        getVariables(variables);

        phylo_tree->clearAllPartialLH();
        score = phylo_tree->computeLikelihood();

        delete [] bound_check;
        delete [] lower_bound;
        delete [] upper_bound;
        delete [] variables;

        return score;
    } else {
        string errMsg = "Unknown optimization algorithm: " + optimize_alg;
        outError(errMsg.c_str());
        return 0.0;
    }
}
 void QIntConfigurableTileWidget::reloadConfigurableData() {
   stopSignaling = true;
   setBounds();
   int value = config->getParam(key);
   spBox.setValue(value);
   slider.setValue(value);
   stopSignaling = false;
   updatePaletteChanged();
 }
 void QIntConfigurableTileWidget::sl_resetToOriginalValuesAndBounds() {
   config->setParam(key, origValue);
   config->setParamBounds(key, origBounds.first, origBounds.second);
   setBounds();
   // values
   spBox.setValue(origValue);
   slider.setValue(origValue);
   updatePaletteChanged();
 }
Пример #5
0
DrawableImage::DrawableImage (const DrawableImage& other)
    : Drawable (other),
      image (other.image),
      opacity (other.opacity),
      overlayColour (other.overlayColour),
      bounds (other.bounds)
{
    setBounds (other.getBounds());
}
int ONVIF::VideoSourceConfiguration::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 5)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 5;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 5)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 5;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = token(); break;
        case 1: *reinterpret_cast< QString*>(_v) = name(); break;
        case 2: *reinterpret_cast< int*>(_v) = useCount(); break;
        case 3: *reinterpret_cast< QString*>(_v) = sourceToken(); break;
        case 4: *reinterpret_cast< QRect*>(_v) = bounds(); break;
        default: break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setToken(*reinterpret_cast< QString*>(_v)); break;
        case 1: setName(*reinterpret_cast< QString*>(_v)); break;
        case 2: setUseCount(*reinterpret_cast< int*>(_v)); break;
        case 3: setSourceToken(*reinterpret_cast< QString*>(_v)); break;
        case 4: setBounds(*reinterpret_cast< QRect*>(_v)); break;
        default: break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 5;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 5)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 5;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Пример #7
0
void pspRoomConfigGUI::setup(){
    
    setOpaque(true);
    setBounds(0, 0, 100, 100);
    addAndMakeVisible(panel);
    createWidgets();
    
    
}
Пример #8
0
static int getPlot3d(int iAxeUID, scicos_block * block)
{
    int iPlot3d;

    sco_data *sco = (sco_data *) * (block->work);

    // assert the sco is not NULL
    if (sco == NULL)
    {
        return 0;
    }

    // fast path for an existing object
    if (sco->scope.cachedPlot3dUID)
    {
        return sco->scope.cachedPlot3dUID;
    }

    iPlot3d = findChildWithKindAt(iAxeUID, __GO_PLOT3D__, 0);

    /*
     * Allocate if necessary
     */
    if (iPlot3d == 0)
    {
        iPlot3d = createGraphicObject(__GO_PLOT3D__);

        if (iPlot3d != 0)
        {
            createDataObject(iPlot3d, __GO_PLOT3D__);
            setGraphicObjectRelationship(iAxeUID, iPlot3d);
        }
        else
        {
            return 0;
        }
    }

    /*
     * Setup on first access
     */
    setBounds(block, iAxeUID, iPlot3d);
    setPlot3dSettings(iPlot3d);
    setDefaultValues(block, iPlot3d);

    {
        int iClipState = 1; //on
        setGraphicObjectProperty(iPlot3d, __GO_CLIP_STATE__, &iClipState, jni_int, 1);
    }

    /*
     * then cache with a local storage
     */
    sco->scope.cachedPlot3dUID = iPlot3d;
    return sco->scope.cachedPlot3dUID;
}
Пример #9
0
Mesh::Mesh(const DFFGeometry& geometry, bool autoSubmeshes)
		: vertexCount(geometry.getVertexCount()), frame(NULL)
{
	flags = 0;
	const float* vertices = geometry.getVertices();
	const float* normals = geometry.getNormals();
	const uint8_t* colors = geometry.getVertexColors();
	const float* texCoords = NULL;
	const uint8_t* boneIndices = geometry.getBoneIndices();
	const float* boneWeights = geometry.getBoneWeights();

	if (geometry.getUVSetCount() > 0) {
		texCoords = geometry.getUVCoordSet(0);
	}

	if (geometry.isTriangleStripFormat()) {
		vertexFormat = VertexFormatTriangleStrips;
	} else {
		vertexFormat = VertexFormatTriangles;
	}

	if (normals) {
		flags |= MeshNormals;
	}
	if (texCoords) {
		flags |= MeshTexCoords;
	}
	if (colors) {
		flags |= MeshVertexColors;
	}
	if (boneIndices) {
		flags |= MeshSkinData;
	}

	if (geometry.isDynamicLightingEnabled()) {
		flags |= MeshDynamicLighting;
	}

	DFFGeometry::ConstMaterialIterator it;
	for (it = geometry.getMaterialBegin() ; it != geometry.getMaterialEnd() ; it++) {
		Material* material = new Material(**it);
		addMaterial(material);
	}

	if (autoSubmeshes) {
		DFFGeometry::ConstPartIterator pit;
		for (pit = geometry.getPartBegin() ; pit != geometry.getPartEnd() ; pit++) {
			Submesh* submesh = new Submesh(this, **pit);
		}
	}

	const DFFBoundingSphere* b = geometry.getBounds();
	setBounds(b->x, b->y, b->z, b->radius);

	init(flags, vertices, normals, texCoords, colors, boneIndices, boneWeights);
}
Пример #10
0
void Movie::releaseMovie() {
	if (_video) {
		delete _video;
		_video = 0;
		disposeAllCallBacks();
		deallocateSurface();
	}

	setBounds(Common::Rect(0, 0, 0, 0));
}
Пример #11
0
void GraphNode::updateBoundaries()
{

    int level = getLevel();

    int horzShift = gv->getHorizontalShift(this);
    
    setBounds(20+horzShift*140, 20+getLevel()*40, 150, 50);

}
Пример #12
0
   CylinderMesh::CylinderMesh (Box &_bounds, float _radius, float _complexity)
   {
      setRadius (_radius) ;
      setBounds (_bounds) ;
      setCenter (_bounds.min.midpoint(_bounds.max)) ;

      complexity = _complexity ;

      construct() ;
   }
Пример #13
0
void Symm1D::
init()
{
    _init(1);
    setBounds(0, -1.0, 1.0);

    // set tolerances
    setSteadyTolerances(1e-4, 1e-4);
    setTransientTolerances(1e-4, 1e-4);
}
Пример #14
0
void Button::setParams(int x, int y, int w, int h, bool& f, const string& file)
{
	if (bounds == NULL)
		bounds = new SDL_Rect;

    setCoordinates(x,y);
    setBounds(w,h);
    setFlag(f);
    setSource(file);
}
Пример #15
0
bool ReaScriptWindow::addControlFromName(std::string cname, std::string objectname)
{
	if (cname == "Button")
	{
		auto c = std::make_shared<WinButton>(this, objectname);
		c->setObjectName(objectname);
		c->GenericNotifyCallback = [this, objectname](GenericNotifications)
		{
			m_dirty_controls.insert(objectname);
		};
		c->setBounds({ 5, 5, 50, 25 });
		add_control(c);
		return true;
	}
	else if (cname == "Slider")
	{
		auto c = std::make_shared<ReaSlider>(this);
		c->setObjectName(objectname);
		c->SliderValueCallback = [this, objectname](GenericNotifications, double)
		{
			m_dirty_controls.insert(objectname);
		};
		c->setBounds({ 5, 5, 50, 25 });
		add_control(c);
		return true;
	}
	else 
	{
		auto c = create_licecontrol(this, cname);
		if (c != nullptr)
		{
			c->setObjectName(objectname);
			c->GenericNotifyCallback = [this, objectname](GenericNotifications)
			{
				m_dirty_controls.insert(objectname);
			};
			c->setBounds({ 5, 5, 50, 25 });
			add_control(c);
			return true;
		}
	}
	return false;
}
Пример #16
0
void PHScrollerView::setFrame(const PHRect &frame)
{
    PHPoint b(_bounds.width, _bounds.height);
    PHView::setFrame(frame);
    setBounds(bounds()/scl);
    if (content)
    {
        PHPoint c(_bounds.width, _bounds.height);
        content->setPosition((c-b)/2+content->position());
    }
}
Пример #17
0
void Render::resizeGL(const int nWidth, const int nHeight) {
    int width = nWidth;
    int height = nHeight? nHeight: 1;
    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    float aspectRatio = (float)width/height;
    if (width <= height) {
        setBounds(-viewRadius, viewRadius, -viewRadius/aspectRatio,
                  viewRadius/aspectRatio);
     } else {
        setBounds(-viewRadius*aspectRatio, viewRadius*aspectRatio,
                  -viewRadius, viewRadius);
    }
    glOrtho(getLeftBound(), getRightBound(), getBottomBound(), getTopBound(),
            1.0, -1.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    updateGraph();
}
Пример #18
0
void MVScrollBar::moveTo(int x,int y)
/****************************************************************************
*
* Function:		MVScrollBar::moveTo
* Parameters:	x,y	- Position to move the scroll bar to
*
****************************************************************************/
{
	MVView::moveTo(x,y);
	setBounds(bounds);
}
Пример #19
0
Reader::Reader(const Options& options, const PointBuffer& buffer)
    : pdal::Reader(options)
    , m_buffer(buffer)
{
    setNumPoints(buffer.getNumPoints());
    setBounds(buffer.getSpatialBounds());
    setSchema(buffer.getSchema());
    setPointCountType(PointCount_Fixed);

    return;
}
Пример #20
0
void Surf1D::
init()
{
    _init(1);
    // set bounds (T)
    setBounds(0, 200.0, 1e5);

    // set tolerances
    setSteadyTolerances(1e-4, 1e-4);
    setTransientTolerances(1e-4, 1e-4);
}
Пример #21
0
void ComponentLayoutEditor::bindWithTarget ()
{
    if (target != NULL)
    {
        Component* t = (Component*) target.getComponent ();
        Component* p = t->getParentComponent ();
        p->addAndMakeVisible (this);
        setBounds (t->getBounds ());
        updateFrames ();
    }
}
Пример #22
0
void Drawable::setBoundsToEnclose (Rectangle<float> area)
{
    Point<int> parentOrigin;

    if (auto* parent = getParent())
        parentOrigin = parent->originRelativeToComponent;

    auto newBounds = area.getSmallestIntegerContainer() + parentOrigin;
    originRelativeToComponent = parentOrigin - newBounds.getPosition();
    setBounds (newBounds);
}
Пример #23
0
void TimelineIndicator::mouseDrag (const MouseEvent& ev)
{
    if (! dragable())
        return;

    Rectangle<int> r (getBoundsInParent());

    dragger.dragComponent (this, ev, nullptr);
    int snap = shouldSnap ? timeline()->pixelSnap (getBoundsInParent().getX())
                          : getBoundsInParent().getX();

    setBounds (r); // reset it back to normal

    if (snap != lastSnap || ! shouldSnap)
    {
        setBounds (snap, 0, 1, timeline()->getHeight());
        pos.setValue (getUnits());
        lastSnap = snap;
    }
}
Пример #24
0
void Drawable::setBoundsToEnclose (const Rectangle<float>& area)
{
    Drawable* const parent = getParent();
    Point<int> parentOrigin;
    if (parent != 0)
        parentOrigin = parent->originRelativeToComponent;

    const Rectangle<int> newBounds (area.getSmallestIntegerContainer() + parentOrigin);
    originRelativeToComponent = parentOrigin - newBounds.getPosition();
    setBounds (newBounds);
}
Пример #25
0
GuiInspectorDynamicField::GuiInspectorDynamicField( GuiInspector *inspector,
                                                    GuiInspectorGroup* parent, 
                                                    SimFieldDictionary::Entry* field )
 : mRenameCtrl( NULL ),
   mDeleteButton( NULL )
{
   mInspector = inspector;
   mParent = parent;
   mDynField = field;
   setBounds(0,0,100,20);   
}
    BluetoothMidiSelectorOverlay()
    {
        setAlwaysOnTop (true);
        setVisible (true);
        addToDesktop (ComponentPeer::windowHasDropShadow);
        setBounds (0, 0, getParentWidth(), getParentHeight());
        toFront (true);

        addAndMakeVisible (bluetoothDevicesList);
        enterModalState (true, nullptr, true);
    }
Пример #27
0
void CallOutBox::updatePosition (const Rectangle<int>& newAreaToPointTo, const Rectangle<int>& newAreaToFitIn)
{
    targetArea = newAreaToPointTo;
    availableArea = newAreaToFitIn;

    const int borderSpace = getBorderSize();

    Rectangle<int> newBounds (content.getWidth()  + borderSpace * 2,
                              content.getHeight() + borderSpace * 2);

    const int hw = newBounds.getWidth() / 2;
    const int hh = newBounds.getHeight() / 2;
    const float hwReduced = (float) (hw - borderSpace * 2);
    const float hhReduced = (float) (hh - borderSpace * 2);
    const float arrowIndent = borderSpace - arrowSize;

    Point<float> targets[4] = { Point<float> ((float) targetArea.getCentreX(), (float) targetArea.getBottom()),
                                Point<float> ((float) targetArea.getRight(),   (float) targetArea.getCentreY()),
                                Point<float> ((float) targetArea.getX(),       (float) targetArea.getCentreY()),
                                Point<float> ((float) targetArea.getCentreX(), (float) targetArea.getY()) };

    Line<float> lines[4] = { Line<float> (targets[0].translated (-hwReduced, hh - arrowIndent),    targets[0].translated (hwReduced, hh - arrowIndent)),
                             Line<float> (targets[1].translated (hw - arrowIndent, -hhReduced),    targets[1].translated (hw - arrowIndent, hhReduced)),
                             Line<float> (targets[2].translated (-(hw - arrowIndent), -hhReduced), targets[2].translated (-(hw - arrowIndent), hhReduced)),
                             Line<float> (targets[3].translated (-hwReduced, -(hh - arrowIndent)), targets[3].translated (hwReduced, -(hh - arrowIndent))) };

    const Rectangle<float> centrePointArea (newAreaToFitIn.reduced (hw, hh).toFloat());
    const Point<float> targetCentre (targetArea.getCentre().toFloat());

    float nearest = 1.0e9f;

    for (int i = 0; i < 4; ++i)
    {
        Line<float> constrainedLine (centrePointArea.getConstrainedPoint (lines[i].getStart()),
                                     centrePointArea.getConstrainedPoint (lines[i].getEnd()));

        const Point<float> centre (constrainedLine.findNearestPointTo (targetCentre));
        float distanceFromCentre = centre.getDistanceFrom (targets[i]);

        if (! centrePointArea.intersects (lines[i]))
            distanceFromCentre += 1000.0f;

        if (distanceFromCentre < nearest)
        {
            nearest = distanceFromCentre;

            targetPoint = targets[i];
            newBounds.setPosition ((int) (centre.x - hw),
                                   (int) (centre.y - hh));
        }
    }

    setBounds (newBounds);
}
Пример #28
0
MaxOpenGlComponent::MaxOpenGlComponent()
{
    setBounds(-10, -10, 1, 1);
    m_context = new OpenGLContext();
    m_context->setComponentPaintingEnabled(false);

	m_context->setRenderer(this); // need this to set m_scale
    m_context->attachTo(*this);
    m_context->setContinuousRepainting(false);
    setInterceptsMouseClicks(false, false);
}
void Outlet1D::init()
{
    _init(1);
    setBounds(0, -1.0, 1.0);

    if (m_flow_right) {
        m_flow_right->setViscosityFlag(false);
    }
    if (m_flow_left) {
        m_flow_left->setViscosityFlag(false);
    }
}
Пример #30
0
void PaintElement::updateBounds (const Rectangle<int>& parentArea)
{
    if (! parentArea.isEmpty())
    {
        setBounds (getCurrentBounds (parentArea)
                        .expanded (borderThickness,
                                   borderThickness));

        for (int i = siblingComponents.size(); --i >= 0;)
            siblingComponents.getUnchecked(i)->updatePosition();
    }
}