Figure out the starting waveform segment that corresponds to the specified coordinate in the window.

@param x the column being drawn

@return the offset into the waveform at the current scale and playback time that should be drawn there
969079
private int getSegmentForX(int x) {
        if (autoScroll.get()) {
            int playHead = (x - (getWidth() / 2));
            int offset = Util.timeToHalfFrame(getFurthestPlaybackPosition()) / scale.get();
            return  (playHead + offset) * scale.get();
        }
        return x * scale.get();
    }
604375
protected int getSeqPos(int panelPos){


		int seqPos = Math.round((panelPos - SequenceScalePanel.DEFAULT_X_START) / scale) ;
		if ( seqPos < 0)
			seqPos = 0;
		//int length = chainLength;
		//if ( seqPos >= length)
		 //   seqPos = length-1;
		return seqPos;
	}
1183557
private void processXEvent(X.XEvent event,
                               RunnableProcessor runnableProcessor) {
        switch (X.XEvent.getType(event.p)) {
            case X.ButtonPress: {
                X.XButtonEvent buttonEvent = new X.XButtonEvent(event);
                int button = X.XButtonEvent.getButton(buttonEvent.p);
                runnableProcessor.invokeLater(new ButtonPressProcessor(button));
                break;
            }
            case X.ButtonRelease: {
                X.XButtonEvent buttonEvent = new X.XButtonEvent(event);
                int button = X.XButtonEvent.getButton(buttonEvent.p);
                runnableProcessor.invokeLater(
                        new ButtonReleaseProcessor(button));
                break;
            }
            case X.MotionNotify: {
                X.XMotionEvent motionEvent = new X.XMotionEvent(event);
                int x = X.XMotionEvent.getX(motionEvent.p);
                int y = X.XMotionEvent.getY(motionEvent.p);
                runnableProcessor.invokeLater(new MotionProcessor(x, y));
                break;
            }
        }
    }
411345
private int locate(double x) {
        int ju, jm, jl;

        boolean ascnd = (xx[n - 1] >= xx[0]);

        jl = 0;
        ju = n - 1;
        while (ju - jl > 1) {
            jm = (ju + jl) >> 1;
            if (x >= xx[jm] == ascnd) {
                jl = jm;
            } else {
                ju = jm;
            }
        }

        cor = Math.abs(jl - jsav) <= dj;
        jsav = jl;

        return Math.max(0, Math.min(n - 2, jl));
    }
1371116
int getColumnByXWithShift(int x, int shiftEveryStep) {
        checkForInit();
        int sum = 0;
        // header offset
        int tempX = x - mHeaderRowWidth;
        if (tempX <= sum) {
            return 0;
        }
        for (int count = mColumnWidths.length, i = 0; i < count; i++) {
            int nextSum = sum + mColumnWidths[i] + shiftEveryStep;
            if (tempX > sum && tempX < nextSum) {
                return i;
            } else if (tempX < nextSum) {
                return i - 1;
            }
            sum = nextSum;
        }
        return mColumnWidths.length - 1;
    }
1013287
private void drawTickMarks(final GraphicsContext CTX) {
        tickMarkCanvas.setCache(false);
        CTX.clearRect(0, 0, tickMarkCanvas.getWidth(), tickMarkCanvas.getHeight());
        CTX.setFill(gauge.getMajorTickMarkColor());

        List<Section> tickMarkSections         = gauge.getTickMarkSections();
        List<Section> tickLabelSections        = gauge.getTickLabelSections();
        Color         majorTickMarkColor       = gauge.getTickMarkColor();
        Color         tickLabelColor           = gauge.getTickLabelColor();
        boolean       smallRange               = Double.compare(gauge.getRange(), 10.0) <= 0;
        double        minValue                 = gauge.getMinValue();
        double        maxValue                 = gauge.getMaxValue();
        double        tmpStepSize              = smallRange ? stepSize / 10 : stepSize;
        Font          tickLabelFont            = Fonts.robotoRegular(0.15 * (Orientation.VERTICAL == orientation ? width : height));
        boolean       tickMarkSectionsVisible  = gauge.getTickMarkSectionsVisible();
        boolean       tickLabelSectionsVisible = gauge.getTickLabelSectionsVisible();
        double        offsetX                  = 0.18345865 * width;
        double        offsetY                  = 0.1 * height;
        double        innerPointX              = 0;
        double        innerPointY              = 0;
        double        outerPointX              = 0.07 * width;
        double        outerPointY              = 0.08 * height;
        double        textPointX               = 0.55 * tickMarkCanvas.getWidth();
        double        textPointY               = 0.7 * tickMarkCanvas.getHeight();
        BigDecimal    minorTickSpaceBD         = BigDecimal.valueOf(gauge.getMinorTickSpace());
        BigDecimal    majorTickSpaceBD         = BigDecimal.valueOf(gauge.getMajorTickSpace());
        BigDecimal    counterBD                = BigDecimal.valueOf(gauge.getMinValue());
        double        counter                  = minValue;
        double        range                    = gauge.getRange();

        for (double i = 0 ; Double.compare(i, range) <= 0 ; i++) {
            if (Orientation.VERTICAL == orientation) {
                innerPointY = counter * tmpStepSize + offsetY;
                outerPointY = innerPointY;
                textPointY  = innerPointY;
            } else {
                innerPointX = counter * tmpStepSize + offsetX;
                outerPointX = innerPointX;
                textPointX  = innerPointX;
            }

            // Set the general tickmark color
            CTX.setStroke(gauge.getTickMarkColor());
            if (Double.compare(counterBD.remainder(majorTickSpaceBD).doubleValue(), 0.0) == 0) {
                // Draw major tick mark
                if (gauge.getMajorTickMarksVisible()) {
                    CTX.setFill(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, majorTickMarkColor) : majorTickMarkColor);
                    CTX.setStroke(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, majorTickMarkColor) : majorTickMarkColor);
                    CTX.setLineWidth(1);
                    CTX.strokeLine(innerPointX, innerPointY, outerPointX, outerPointY);
                }
                // Draw tick label text
                if (gauge.getTickLabelsVisible()) {
                    CTX.save();
                    CTX.translate(textPointX, textPointY);
                    CTX.setFont(tickLabelFont);
                    CTX.setTextAlign(TextAlignment.CENTER);
                    CTX.setTextBaseline(VPos.CENTER);
                    CTX.setFill(tickLabelSectionsVisible ? Helper.getColorOfSection(tickLabelSections, counter, tickLabelColor) : tickLabelColor);
                    if (Orientation.VERTICAL == orientation) {
                        CTX.fillText(Integer.toString((int) (maxValue - counter)), 0, 0);
                    } else {
                        CTX.fillText(Integer.toString((int) counter), 0, 0);
                    }
                    CTX.restore();
                }
            }
            counterBD = counterBD.add(minorTickSpaceBD);
            counter   = counterBD.doubleValue();
            if (counter > maxValue) break;
        }

        tickMarkCanvas.setCache(true);
        tickMarkCanvas.setCacheHint(CacheHint.QUALITY);
    }
1269742
public LatLong fromPixels(double x, double y) {
        if (this.mapView.getWidth() <= 0 || this.mapView.getHeight() <= 0) {
            return null;
        }

        // this uses the framebuffer position, the mapview position can be out of sync with
        // what the user sees on the screen if an animation is in progress
        MapPosition mapPosition = this.mapView.getModel().frameBufferModel.getMapPosition();

        // this means somehow the mapview is not yet properly set up, see issue #308.
        if (mapPosition == null) {
            return null;
        }

        // calculate the pixel coordinates of the top left corner
        LatLong latLong = mapPosition.latLong;
        long mapSize = MercatorProjection.getMapSize(mapPosition.zoomLevel, this.mapView.getModel().displayModel.getTileSize());
        double pixelX = MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize);
        double pixelY = MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize);
        pixelX -= this.mapView.getWidth() >> 1;
        pixelY -= this.mapView.getHeight() >> 1;

        // catch outer map limits
        try {
            // convert the pixel coordinates to a LatLong and return it
            return new LatLong(MercatorProjection.pixelYToLatitude(pixelY + y, mapSize),
                    MercatorProjection.pixelXToLongitude(pixelX + x, mapSize));
        } catch (Exception e) {
            return null;
        }
    }
588225
function getSingleMarkerEndPoint(data, idx, dims, seriesModel, api) {
    var coordSys = seriesModel.coordinateSystem;
    var itemModel = data.getItemModel(idx);

    var point;
    var xPx = numberUtil.parsePercent(itemModel.get(dims[0]), api.getWidth());
    var yPx = numberUtil.parsePercent(itemModel.get(dims[1]), api.getHeight());
    if (!isNaN(xPx) && !isNaN(yPx)) {
        point = [xPx, yPx];
    }
    else {
        // Chart like bar may have there own marker positioning logic
        if (seriesModel.getMarkerPosition) {
            // Use the getMarkerPoisition
            point = seriesModel.getMarkerPosition(
                data.getValues(dims, idx)
            );
        }
        else {
            var x = data.get(dims[0], idx);
            var y = data.get(dims[1], idx);
            var pt = [x, y];
            coordSys.clampData && coordSys.clampData(pt, pt);
            point = coordSys.dataToPoint(pt, true);
        }
        if (coordSys.type === 'cartesian2d') {
            var xAxis = coordSys.getAxis('x');
            var yAxis = coordSys.getAxis('y');
            var x = data.get(dims[0], idx);
            var y = data.get(dims[1], idx);
            if (isInifinity(x)) {
                point[0] = xAxis.toGlobalCoord(xAxis.getExtent()[dims[0] === 'x0' ? 0 : 1]);
            }
            else if (isInifinity(y)) {
                point[1] = yAxis.toGlobalCoord(yAxis.getExtent()[dims[1] === 'y0' ? 0 : 1]);
            }
        }

        // Use x, y if has any
        if (!isNaN(xPx)) {
            point[0] = xPx;
        }
        if (!isNaN(yPx)) {
            point[1] = yPx;
        }
    }

    return point;
}
250080
@Pure
	public double toGlobalX(double x) {
		final double adjustedX = x - this.translationX.get();
		return this.invertX.get() ? -adjustedX : adjustedX;
	}
532127
public float getX() {
    if (DocumentElement_Type.featOkTst && ((DocumentElement_Type)jcasType).casFeat_x == null)
      jcasType.jcas.throwFeatMissing("x", "ch.epfl.bbp.uima.types.DocumentElement");
    return jcasType.ll_cas.ll_getFloatValue(addr, ((DocumentElement_Type)jcasType).casFeatCode_x);}
933912
public Point2D getStartAdjusted()
    {
        final Point2D viewportLoc = new Point2D(getDragStartX(), getDragStartY());

        m_vtog.transform(viewportLoc, viewportLoc);

        return viewportLoc;
    }
660559
@Override
	public int getLocationX() throws WidgetException {
		try {
			Point p = findElement().getLocation();
			return p.getX();
		} catch (Exception e) {
			throw new WidgetException("Error while fetching X location", locator, e);
		}
	}
733416
static int codePointBeforeImpl(char[] a, int index, int start) {
        char c2 = a[--index];
        if (isLowSurrogate(c2) && index > start) {
            char c1 = a[--index];
            if (isHighSurrogate(c1)) {
                return toCodePoint(c1, c2);
            }
        }
        return c2;
    }
765835
void querySegmentXY(int half_edge, SegmentBuffer outBuffer) {
		outBuffer.createLine();
		Segment seg = outBuffer.get();
		Point2D pt = new Point2D();
		getHalfEdgeFromXY(half_edge, pt);
		seg.setStartXY(pt);
		getHalfEdgeToXY(half_edge, pt);
		seg.setEndXY(pt);
	}
1137945
def begin_x(self):
        
        cxnSp = self._element
        x, cx, flipH = cxnSp.x, cxnSp.cx, cxnSp.flipH
        begin_x = x+cx if flipH else x
        return Emu(begin_x)
1242641
protected void xAxis(Graphics g) {
        g.setColor(Color.BLACK);

        // x-axis line
        g.drawLine(X_OFFSET_LEFT, calcY(0), width + X_OFFSET_LEFT, calcY(0));

        drawXLabels(g);
    }
508382
private String getPoint() {

        CmsImagePreviewHandler handler = getImagePreviewHandler();
        if (handler == null) {
            return null;
        }

        CmsPoint point = handler.getImageInfo().getFocalPoint();
        if (point == null) {
            return null;
        }
        int x = (int)point.getX();
        int y = (int)point.getY();
        return "" + x + " , " + y;
    }