java:如何将多线串转换为多边形

时间:2018-05-15 10:14:19

标签: java geotools

我有两个峡谷区域的轮廓线串,但它们没有关闭。显然,它们确实代表了一个结果区域。如何通过代码关闭它们?

让我们说两个线串如

func updateTermsComplete(userLogin: String, termsPermission: String){
    let context = self.persistentContainer.viewContext
    context.automaticallyMergesChangesFromParent = true
    let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "User")
    fetchRequest.predicate = NSPredicate(format: "email == %@", userLogin)
    fetchRequest.returnsObjectsAsFaults = false
    do {
        userRecord = try context.fetch(fetchRequest) as! [User]
    } catch {
        print("No user found")
    }
    if !userRecord.isEmpty {
        print("User already exists")
        userRecord[0].setValue(termsPermission, forKey: "acceptedTerms")
        do {
            try context.save()
            print("User updated")
        } catch let error as NSError  {
            print("Could not save \(error), \(error.userInfo)")
        } catch {   
        }
        self.saveContext()
    }
    context.refreshAllObjects()
}

func saveContext () {
    let context = persistentContainer.viewContext
    context.automaticallyMergesChangesFromParent = true
    if context.hasChanges {
        do {
            try context.save()
        } catch {
            let nserror = error as NSError
            fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
        }
    }
}

如何获得结果

<% content_for :javascript do %>
 <%= javascript_include_tag 'audio_files.js' %>

 <script>
  $(function() {
      Dropzone.autoDiscover = false;

      var mediaDropzone= new Dropzone("#media-dropzone",
          {maxFilesize: 2000,
              paramName: "audio_file[file]",
              maxFiles:1,
              timeout:0 ,

              init: function() {
                  this.on("maxfilesexceeded", function(file){
                      alert("No more files please!");
                  });
              },
              complete: function (file) {
                  if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
                      //once all the files have been uploaded - close window and refresh page.
                      //close modal and refresh page.
                      //alert("MADE IT HERE");
                      $('#download').modal('hide');
                      location.reload();
                  }
                  }

          });// max file size is 256MB // set param of uploaded file.)


     /* $("#media-dropzone").dropzone({
          paramName: "audio_file[file]"
      });*/

      //return mediaDropzone.on("success", function(file, responseText) {
          //var imageUrl;
          //imageUrl = responseText.file_name.url;
     // });
      Dropzone.options.mediaDropzone= {
          headers: {
              'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
          }

      }
  });

任何帮助都表示赞赏。

0 个答案:

没有答案