/**
   * Creates an instance of this class
   *
   * @param aWorkbench IWorkbench
   */
  protected WspWinExportProjectSelectionPage(
      final String pageName, final WspWinExportProjectData data) {
    super(pageName);

    m_data = data;

    setTitle(Messages.getString("WspWinExportProjectSelectionPage_0")); // $NON-NLS-1$
    setDescription(Messages.getString("WspWinExportProjectSelectionPage_1")); // $NON-NLS-1$
  }
Пример #2
0
  @Override
  public void validate(final IProfile profil, final IValidatorMarkerCollector collector)
      throws CoreException {
    if (profil == null) return;

    final IRecord[] points = profil.getPoints();
    final IComponent cB = profil.hasPointProperty(IWspmConstants.POINT_PROPERTY_BREITE);
    final IComponent cH = profil.hasPointProperty(IWspmConstants.POINT_PROPERTY_HOEHE);
    if (cB == null || cH == null || points.length < 1) return;
    final double deltaX = cB.getPrecision();
    final double deltaY = cH.getPrecision();

    for (int i = 1; i < points.length; i++) {
      final Double x1 =
          ProfileUtil.getDoubleValueFor(IWspmConstants.POINT_PROPERTY_BREITE, points[i - 1]);
      final Double x2 =
          ProfileUtil.getDoubleValueFor(IWspmConstants.POINT_PROPERTY_BREITE, points[i]);
      final Double y1 =
          ProfileUtil.getDoubleValueFor(IWspmConstants.POINT_PROPERTY_HOEHE, points[i - 1]);
      final Double y2 =
          ProfileUtil.getDoubleValueFor(IWspmConstants.POINT_PROPERTY_HOEHE, points[i]);
      if (x1.isNaN()) {
        collector.createProfilMarker(
            IMarker.SEVERITY_ERROR,
            Messages.getString("org.kalypso.model.wspm.tuhh.ui.rules.RuecksprungRule.0"),
            String.format("km %.4f", profil.getStation()),
            i - 1,
            IWspmConstants.POINT_PROPERTY_BREITE); // $NON-NLS-1$ //$NON-NLS-2$
      } else if (y1.isNaN()) {
        collector.createProfilMarker(
            IMarker.SEVERITY_ERROR,
            Messages.getString("org.kalypso.model.wspm.tuhh.ui.rules.RuecksprungRule.1"),
            String.format("km %.4f", profil.getStation()),
            i - 1,
            IWspmConstants.POINT_PROPERTY_BREITE); // $NON-NLS-1$ //$NON-NLS-2$
      } else if (x2.isNaN() || y2.isNaN()) {
        continue;
      } else if (x1 - x2 > deltaX) {
        collector.createProfilMarker(
            IMarker.SEVERITY_ERROR,
            Messages.getString("org.kalypso.model.wspm.tuhh.ui.rules.RuecksprungRule.2", x2),
            String.format("km %.4f", profil.getStation()),
            i,
            IWspmConstants.POINT_PROPERTY_BREITE); // $NON-NLS-1$ //$NON-NLS-2$
      } else if (Math.abs(x2 - x1) < deltaX && Math.abs(y2 - y1) > deltaY) {
        collector.createProfilMarker(
            IMarker.SEVERITY_WARNING,
            Messages.getString("org.kalypso.model.wspm.tuhh.ui.rules.RuecksprungRule.4", x2),
            String.format("km %.4f", profil.getStation()),
            i,
            IWspmConstants.POINT_PROPERTY_BREITE); // $NON-NLS-1$ //$NON-NLS-2$
      }
    }
  }
Пример #3
0
 public void export(
     final IProfileFeature[] profiles, final File file, final IProgressMonitor monitor)
     throws CoreException {
   try {
     writeProfiles(profiles, file, monitor);
   } catch (final IOException e) {
     final String message = String.format(Messages.getString("SinkExporter_0")); // $NON-NLS-1$
     final IStatus status =
         new Status(IStatus.ERROR, KalypsoModelWspmCorePlugin.getID(), message, e);
     throw new CoreException(status);
   } finally {
     monitor.done();
   }
 }
Пример #4
0
  private void writeProfiles(
      final IProfileFeature[] profileFeatures,
      final OutputStream os,
      final IProgressMonitor monitor)
      throws IOException {
    monitor.beginTask(Messages.getString("SinkExporter_1"), profileFeatures.length); // $NON-NLS-1$

    final IProfile[] profiles = ProfileFeatureSorter.extractProfiles(profileFeatures, monitor);
    // new IProfil[profileFeatures.length];
    // for( int i = 0; i < profiles.length; i++ )
    // {
    // profiles[i] = profileFeatures[i].getProfil();
    // ProgressUtilities.worked( monitor, 1 );
    // }

    // FIXME: what encoding?
    final OutputStreamWriter writer = new OutputStreamWriter(os);
    m_sink.write(profiles, writer);
    writer.flush();

    monitor.done();
  }