from GridMarker.toolprocessing.DopTool import findAvtoStepLatLong


def findAvtoStep(xmin,ymin,xmax,ymax,def_count_interval=5):
    dx=xmax-xmin
    dy=ymax-ymin
    d=dx
    if dx<dy:
        d=dy
    step_def=d/def_count_interval
    isFind=False
    level=0
    while(not isFind):
        new_step_round=int(round(step_def,level))
        if new_step_round==0:
            break
        level=level-1
    step=int(round(step_def,level+1))
    return step
property_grid={}
property_grid['xmin']=7323702.95997447
property_grid['xmax']=7669838.06848797
property_grid['ymin']=6009889.59407669
property_grid['ymax']=6292595.56964494
property_grid['xmin']=36.951163679368
property_grid['xmax']=38.3769488247705
property_grid['ymin']=55.4762082306687
property_grid['ymax']=56.0703902954898


#findAvtoStep(property_grid['xmin'],property_grid['ymin'],property_grid['xmax'],property_grid['ymax'],7)
findAvtoStepLatLong(property_grid['xmin'],property_grid['ymin'],property_grid['xmax'],property_grid['ymax'],7)
