# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-10 11:20
from __future__ import unicode_literals

from django.db import migrations, models


def add_geometry_bounds(apps, schema_editor):
    from c3nav.mapdata.models.geometry.base import GeometryMixin

    models = ('AltitudeArea', 'AltitudeMarker', 'Area', 'Building', 'Column', 'Door', 'GraphNode', 'Hole',
              'LineObstacle', 'Obstacle', 'POI', 'Space', 'Stair')
    for model in models:
        model_cls = apps.get_model('mapdata', model)
        for obj in model_cls.objects.all():
            GeometryMixin.recalculate_bounds(obj)
            obj.save()

def remove_geometry_bounds(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('mapdata', '0035_auto_20170916_1216'),
    ]

    operations = [
        migrations.AddField(
            model_name='altitudearea',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='altitudearea',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='altitudearea',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='altitudearea',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='altitudemarker',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='altitudemarker',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='altitudemarker',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='altitudemarker',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='area',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='area',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='area',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='area',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='building',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='building',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='building',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='building',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='column',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='column',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='column',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='column',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='door',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='door',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='door',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='door',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='graphnode',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='graphnode',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='graphnode',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='graphnode',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='hole',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='hole',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='hole',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='hole',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='lineobstacle',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='lineobstacle',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='lineobstacle',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='lineobstacle',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='obstacle',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='obstacle',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='obstacle',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='obstacle',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='poi',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='poi',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='poi',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='poi',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='space',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='space',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='space',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='space',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='stair',
            name='maxx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='stair',
            name='maxy',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='max y coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='stair',
            name='minx',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min x coordinate'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='stair',
            name='miny',
            field=models.DecimalField(db_index=True, decimal_places=2, default=0, max_digits=6, verbose_name='min y coordinate'),
            preserve_default=False,
        ),
        migrations.RunPython(add_geometry_bounds, remove_geometry_bounds),
    ]
